10 Common Coding Interview Problems - Solved!

preview_player
Показать описание
Preparing for coding interviews? Competitive programming? Learn to solve 10 common coding problems and improve your problem-solving skills.

⌨️ (0:00:00) Introduction
⌨️ (0:00:37) Valid anagram
⌨️ (0:05:10) First and last index in sorted array
⌨️ (0:13:44) Kth largest element
⌨️ (0:19:50) Symmetric tree
⌨️ (0:26:42) Generate parentheses
⌨️ (0:37:03) Gas station
⌨️ (0:50:06) Course schedule
⌨️ (1:06:50) Kth permutation
⌨️ (1:20:13) Minimum window substring
⌨️ (1:47:46) Largest rectangle in histogram
⌨️ (2:10:30) Conclusion

🎉 Thanks to our Champion and Sponsor supporters:
👾 Raymond Odero
👾 Agustín Kussrow
👾 aldo ferretti
👾 Otis Morgan
👾 DeezMaster

--

Рекомендации по теме
Комментарии
Автор

3:19 For the anagram you can use 1 hash table but on the 2nd loop when you ask if the character of the second word is not on the table, return false.
If it is on the table then rest 1 on that key.
At the end ask if any value on the hash is not zero, return False.
At last you can return True.

kikeoenr
Автор

I learned for those interview questions, the most important things is to ask the interviewer FOR ALL THE SPECIFIC DETAILS, whether u get a answer or not. Like the size of data, do we need to worry invalid data? what's the definition of anagram do white space count? etc

For the "Kth largest element", you just need to save the largest kth numbers into a array while run through the number and compare it to the Kmin. If it's larger then Kmin, replace the Kmin, and so on.

stefenleung
Автор

I love this channel, even though my English is no accurate to understand all content i always try to collect some good ideas they share. Thank you

safari_
Автор

Rule for finding the middle element at 8:22

There is a chance for overflow when we are adding to massive numbers so instead of dividing directly by 2 we do either of the 2 following approaches:
1. left + (right-left)/2
2. left + right >>> 1

Makwayne
Автор

At 11:29, would it make more sense to set the initial left value to the value found in the find_start method? Although it wouldn't change the time complexity, I think it would result in, on average, one less operation done by the find_end binary search.

theparrot
Автор

For the third problem, with the parethesis,
You may produce all valid parenthesis using the Catalan recursion.

vobieta
Автор

Good night! I live in Brazil I would like to say that your channel has content that others don't.

thiagosoares
Автор

There is a faster method of solving for the Kth largest element. 1. We walk through the array and put elements into the max-heap only for i = 1 to k. 2. For i = k to N, where N = len(arr), we only add arr[i] to the max-heap if arr[i] > heap.peek(). We also have to pop one element to maintain the heap length to k. 3. Once we have completely walked through the array, we return the top element from the heap. Thus we construct a heap of only k elements and walk through the array once.

ratnadeepbhattacharya
Автор

Thank you so much. As always - clear, easy to understand, useful.

yakovkemer
Автор

The last problem in "heights" array there is an extra 10 in list at index 10 after 9, comapred with the histogram.

sinagh
Автор

I have one in 3 hours and you guys posted this just in time! haha

duthegee
Автор

This is amazing I just started applying

darling
Автор

Thanks for the video....It helped a lot !!

thefizzshow
Автор

Thanks a lot for your work. And also side note, you sound a lot like gru which is cute.

amaldev
Автор

The memory complexity of the first one can be further reduced by using a single hash map. The first word increments the values, the second one decrements. After that only 0 must exist as a value in the hash map

ismaelgoldsteck
Автор

question for kth largest element:

We can assume that in the worst case, the kth largest element would be the len(arr)th element. so in the example where arr = [4, 2, 9, 7, 5, 6, 7, 1, 3], you could call for the 9th largest element, which would be the minimum element, which by the solution, you would have to essentially either use len(arr) if either starting from len(arr) - k or from i in range(len(arr)). So could we not assume that in the worst case, k = n and say that the solution 1 would operate in n^2 time since we are characterizing the worst case? or would we technically say that the time complexity is O(kn), with the caveat that k could = n?

kimstuart
Автор

This is really great video. I am hopping similar content with different problems in the future also

prashantsakre
Автор

this just sooo... good, i just wanted this thanks so much

learnwithaaraya
Автор

Just like everytime, High quality content for free . ❤️

dreamerLevel
Автор

Wow, python has so many powerful built-in methods that make algorithm problems much easier, but I am not a python expert and I don't remember many methods in pythons... Still glad python makes the life easier for many people.

linyerin