LeetCode Problem: 217. Contains Duplicate | Java Solution

  Рет қаралды 5,206

Code for Interview

Code for Interview

Жыл бұрын

Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
leetcode.com/problems/contain...
Find the complete playlist of LeetCode Problems
• LeetCode Problem: 709....
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
Do checkout other videos
Java Projects Playlist: • 1/12 - Bank Management...
JavaScript Projects Playlist: • JavaScript Projects
React Projects Playlist: • React Projects
MERN Stack Projects Playlist: • MERN Stack Projects
Spring Boot Full Stack Projects: • Full Stack Projects - ...
Next.js Projects Playlist: • Next.js Projects
Follow Us
Instagram: codeforinterview ( / codeforinterview )
Telegram: codeforinterview (t.me/codeforinterview)

Пікірлер: 20
@codeforinterview
@codeforinterview Жыл бұрын
There is a slight mistake in Brute Force Approach in the video, Please refer below solution for (int i = 0 ; i < nums.length - 1; i++) { // It should go till second last element for (int j = i + 1; j < nums.length ; j++ ) { // We should check the condition with j and increment j, not i if (nums[i] == nums[j]) { return true; } } } return false; If you have a better solution, do comment. and check out the whole playlist of Leetcode questions kzbin.info/www/bejne/mYC1fGOPeriab6M
@vanshmodi14
@vanshmodi14 Жыл бұрын
After knowing the mistake in the video than correcting it in comment box is very rare not everyone do that, we need teachers like you😃😃.
@codeforinterview
@codeforinterview Жыл бұрын
🙌🙌
@anuragsuryawanshi4177
@anuragsuryawanshi4177 Жыл бұрын
Sir, you are amazing I recently started learning DSA in java and for this question I couldn't think beyond brute-force solution, but you explained every solution in a very simplistic manner Please keep making such amazing lectures
@codeforinterview
@codeforinterview Жыл бұрын
thankyou so much 🙌
@anandkumarnitrourkela7404
@anandkumarnitrourkela7404 7 ай бұрын
Great explaination.Keep uploading more such videos.
@codeforinterview
@codeforinterview 7 ай бұрын
Thank you, I will
@sanchitsingh6942
@sanchitsingh6942 Жыл бұрын
Bhaiya agr hume element mil jaye toh return true krke break lga do hume aage again check krne ki zaroorat nhi hai. Thankyou for this .Please Never stop this leetcode series😀
@codeforinterview
@codeforinterview Жыл бұрын
thanks for your comment, one thing to note is return will work like a break statement because if the element is found, it will return the function and will not check any further.
@mansigoyal9664
@mansigoyal9664 Жыл бұрын
Great explaination sir, you are always the besttt. Big fan of you sirrrrrrr👏👏💯💯
@codeforinterview
@codeforinterview Жыл бұрын
Thank you so much 😀
@akshaykumar192
@akshaykumar192 Жыл бұрын
arrays.sort(nums) karne par undeclared identifier kyu bata raha hai ?
@codeforinterview
@codeforinterview Жыл бұрын
I am not sure, I am not able to replicate the same
@suryas8407
@suryas8407 3 ай бұрын
Thank You
@codeforinterview
@codeforinterview 3 ай бұрын
welcome. please find the whole playlist here kzbin.info/www/bejne/mYC1fGOPeriab6M
@videshpundir34
@videshpundir34 Жыл бұрын
Thank you so much..
@codeforinterview
@codeforinterview Жыл бұрын
You're most welcome
@AnasAnsari-xo8bc
@AnasAnsari-xo8bc Жыл бұрын
Bhadia sir Video banate rahiya
@codeforinterview
@codeforinterview Жыл бұрын
Thank you so much 😀
@anoopshetty3580
@anoopshetty3580 3 ай бұрын
let mySet = new Set(nums) let bool = false if(nums.length!=mySet.size) { bool=true } return bool }; how is my code
LeetCode Problem: 344. Reverse String | Java Solution
10:44
Code for Interview
Рет қаралды 3,8 М.
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 76 МЛН
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 163 МЛН
50 YouTubers Fight For $1,000,000
41:27
MrBeast
Рет қаралды 169 МЛН
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 23 МЛН
LeetCode Problem: 171. Excel Sheet Column Number | Java Solution
15:23
Code for Interview
Рет қаралды 1,4 М.
Contains Duplicate - Leetcode 217 - Python
6:31
NeetCode
Рет қаралды 543 М.
LeetCode Problem: 852. Peak Index in a Mountain Array | Java Solution
21:36
Code for Interview
Рет қаралды 4,6 М.
LeetCode Contains Duplicate Solution Explained - Java
5:28
Nick White
Рет қаралды 97 М.
LeetCode Problem: 1. Two Sum | Java Solution
15:51
Code for Interview
Рет қаралды 6 М.
LeetCode Problem: 125. Valid Palindrome | Java Solution
15:40
Code for Interview
Рет қаралды 2,1 М.
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 76 МЛН