Leetcode 1. Two Sum [3 approaches]
Vložit
- čas přidán 10. 02. 2021
- Leetcode 1. Two Sum
leetcode.com/problems/two-sum/
My contact details
Instagram :- / frazmohammad
Connect with me on LinkedIn :- / mohammad-f-bb4886157
Telegram Group t.me/LeadCoding
FREE INTERVIEW PREPARATION SERIES • Free Interview Prepara...
You can practice for coding interview from here
Leetcode Hard :- • Hard
Leetcode Medium :- • Medium
Leetcode Easy :- • Easy
I am Mohammad Fraz , a final year Engineer at DTU and I create content for Coding and technical interviews for FAANG. I explain the intuition to solve Data Structure and Algorithm Questions from leetcode and other platforms. I also cover interview experiences for FAANG and other tech giants. You will also find lectures on the frequently asked interview questions.
Thank You Sir for this awesome and genuine content.
This q looked difficult to me before but now its a piece of cake for me.
All thanks to you Sir, May GBU with lots of love long life success happiness and enjoyment
Thanks a lot again
much detailed solution ❤️🙏
for the same 1st brute force I got :
Runtime: 416 ms, faster than 35.24% of C++ online submissions for Two Sum.
Memory Usage: 10.3 MB, less than 75.73% of C++ online submissions for Two Sum.
So , never get disappointed (it is heavily dependant on server response+ interenet connectivity)
very helpful. deeply geateful.
Line 6: Char 18: error: too few template arguments for class template 'pair'
vector v;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_iterator.h:1286:12: note: template is declared here
struct pair;
^
this error getting using PAIR
at 2:07 I think indices 1,8 can also be the answer
Please share the previous video links
Hey Fraz,
What tools you used to draw on MS Notebook, hardware specs please!
Great explanation Sir......Thank you for the video
At 1:20 you told in the video that watch the previous video...
Please give a link to the previous video of tools and everything else to solve the problems
Is .first and .second is predefined?? for number and index line number 12,13??
Great explanation sir 🙏🙏🙏
Thanks 😊
@@mohammadfraz sir could you please make a detailed video to find time and space complexity for beginners. I can code but cannot calculate sir. please. Thanks in advance;
which previous videos you are talking about here....I tried to find but I couldn't
Fraz Sir I am new to the channel I couldn't find the previous video for this in which u have explained about the stl used for this so could u please help provide me the video links of the previous videos
U are god bro aapke videos motivate to krte hee hai
Saath saath understanding skills ko increase karne me help bhi krte hai
in case of Maps why we are using m.end() ? why we are comparing it to the end element of map?
Fraz i loved this video but i wish to write solution in python since i am new to python i am not able to replicate what you did in java
how can i get some python videos
My o(n) approach -> in for loop, create a string and keep inserting the current index value if it doesnt exists in the string created so far. Thats it.
For explaination, you can DM me
can you explain further?
BESTTTTTTTTT
can somebody please share the link of the previous video he is mentioning about in this video about the approaches?
can you provide the solution in java of approach 2 and 3
cout
pls provide the java code as well sir
Sir time complexity of find function is O(logN)
no ro,searching key in unordered map is 0(1)
Great explanation 🙏
Thanks Ankit
Sir which previous video you are talking here..i couldn't find that video
2nd approach :
if(m.find(y) != m.end())
return (i , m[y])
m[nums[i]] =i;
vaiya please explain it.
which language you are using in the youtube ( C / C++ / Python) video? Difficult to understand it.
19:54 thanks bhaiya
What is the use of the line v.push_back()?
Its insert elements in vector
if anyone person not understand the CPP language and he use the other language then what have to do in this case
Anyone tell me which previous video sir talking
bhai i have written the same code that u have write at time 13:54 but it give the error for the value [3,2,3] for t =6 plz reply
where can we find the lecture which we should watch before watching this video
in interview, if I am able to give the first and second approach and not the third one...is it fine? or do we need to know all the approaches to a problem ?
Depends on the interview level.
previous vidio link ??
czcams.com/video/vAFjNEofa-g/video.html
What is first and second over here, can any one please clarify this ???
Why these CZcamsr prefer c++ instead of java
c++ is fast
C++ is easy af
@@devenderkumar6115 that's a pretty big misconception
C++ is GOAT
if you got the concept then language is not a big issue.
then you can implement in your favourite language
sir not able to understand approach 2
I don't understand why no one does this in JavaScript.
because it is a scripting lan
Any here who can help me ( i can able go code but I don't understand questions) What's the solution for that !?
On a funnier note,
Leetcode 1: Where dreams start
.
.
.
Leetcode 2: Where it ends...
Story of most coders on leetcode 🤭
2nd approach wont work, in case the target is 10, it will return [8,8]
Looking for the fastest two sum solution? We have explained the two sum problem in a very simple, step by step and easy to understand way. Do checkout our videos 🙂
meri english week h thodi
is this the power of god
ye aapne kon si language me coding ki hai
not understood hashmap logic
Why are you speak hindi in channel but your lecture only use English that's kabhi khushi channel se mila jab aap announced kia dsa ke bare me and now kabhi gum
Such a bad explanation in map
No Bro, you should respect efforts! You might be unknown of the map concept.
Bro there is nothing related to respecting efforts. There may be 100 youtubers solving the same solution, all of them putting some effort to upload it but only few of them are able to talk clearly about the concepts I can also upload 100 dsa videos just by writting the codes. I can also put the same effort but whats the point when the viewers dont get the logic behind those codes. Channels like love babbar, striver are far way better when it comes to putting efforts.
@@rahuldeb61 True...Striver is the best when it comes to explanation...Every topic in minute detail...But Fraz is also good for quick revising concepts