
MASTER your coding interview
video description
Date: 2022-03-14
Related videos
Comments and reviews: 10
Panda
1:07:34 The example works because you know how the input array was sorted for you to implement the pivot (ie. left side of pivot is smaller than pivot and right side is larger). The original problem did not stated the input array is sorted nor did it state how the input array is sorted. In general, you would be running your loop in ascending order and ended up working with a descending order sorted input array (or not sorted at all). The implemented pivot method would fail. Therefore, wouldn't the Big O analysis has to be O(nlogn) to account for sorting the input array first for you to know how the input array was sorted?
reply
1:07:34 The example works because you know how the input array was sorted for you to implement the pivot (ie. left side of pivot is smaller than pivot and right side is larger). The original problem did not stated the input array is sorted nor did it state how the input array is sorted. In general, you would be running your loop in ascending order and ended up working with a descending order sorted input array (or not sorted at all). The implemented pivot method would fail. Therefore, wouldn't the Big O analysis has to be O(nlogn) to account for sorting the input array first for you to know how the input array was sorted?
reply
penciltwirler
For the two missing integer problem, there is an elegant math solution.
We can do A = sum(1, ... , N) - sum(arr) like before, but then compute B = sum(1-2, ... ,N-2) - sum(x-2 for x in arr). Let (x, y) be the solution. Then it stands to reason that A = x + y, and B = x-2 + y-2. We have two equations and 2 unknowns, so we can eventually get to a closed form equation and use the quadratic formula to compute x and y. I'll leave it to the reader to figure that out :)
reply
For the two missing integer problem, there is an elegant math solution.
We can do A = sum(1, ... , N) - sum(arr) like before, but then compute B = sum(1-2, ... ,N-2) - sum(x-2 for x in arr). Let (x, y) be the solution. Then it stands to reason that A = x + y, and B = x-2 + y-2. We have two equations and 2 unknowns, so we can eventually get to a closed form equation and use the quadratic formula to compute x and y. I'll leave it to the reader to figure that out :)
reply
my
i undertand code . i just dont understand the language used to describe it . its like code is simple and logic but to describe the concepts they use big words to try confuse people . its elitism . as soon as you simplify how you explain programming coding becomes easy .
reply
i undertand code . i just dont understand the language used to describe it . its like code is simple and logic but to describe the concepts they use big words to try confuse people . its elitism . as soon as you simplify how you explain programming coding becomes easy .
reply
anythgofnthg
Nowhere in the freeCodeCamp curriculum is there even ONE lesson that uses Java. I was really excited when I saw this video, then I became frustrated. Why. why. why!? Not to look a gift horse in the mouth, haha. The problem breakdowns were useful.
reply
Nowhere in the freeCodeCamp curriculum is there even ONE lesson that uses Java. I was really excited when I saw this video, then I became frustrated. Why. why. why!? Not to look a gift horse in the mouth, haha. The problem breakdowns were useful.
reply
Paul
You need to work on the conciseness of your language. You may be a decent programmer but not a good presenter. And Java as a language of choice? Basically, both the presentation and the programming language are too verbose.
reply
You need to work on the conciseness of your language. You may be a decent programmer but not a good presenter. And Java as a language of choice? Basically, both the presentation and the programming language are too verbose.
reply
Karthikeyan
This is the first time I'm looking into a knapsack problem. The recursive approach without cache looks better in terms of space complexity. So if we have the max weight as 50 we need to have 51 columns? hmm.
reply
This is the first time I'm looking into a knapsack problem. The recursive approach without cache looks better in terms of space complexity. So if we have the max weight as 50 we need to have 51 columns? hmm.
reply
StarGazing
Please INCREASE the font size at least 2x, you certainly have enough screen space. I quit after 3 minutes. His glasses magnify the screen for him. Take a lesson from Mosh Hamedani!
reply
Please INCREASE the font size at least 2x, you certainly have enough screen space. I quit after 3 minutes. His glasses magnify the screen for him. Take a lesson from Mosh Hamedani!
reply
Jay
Real challenge would be to build FIFO(first input first output) in a heap which contains duplicate keys. I have done it and believe me its a challenge for sure.
reply
Real challenge would be to build FIFO(first input first output) in a heap which contains duplicate keys. I have done it and believe me its a challenge for sure.
reply
Kar
Note he is using Java language. Should have mentioned that in the title or description or somewhere. But I do appreciate you passing down your knowledge to us.
reply
Note he is using Java language. Should have mentioned that in the title or description or somewhere. But I do appreciate you passing down your knowledge to us.
reply
John
The knapsack solution isn't really a solution. What if you have weights like this: - 1, 5, 3 -. This will just crash with IndexOutOfBounds exception
reply
The knapsack solution isn't really a solution. What if you have weights like this: - 1, 5, 3 -. This will just crash with IndexOutOfBounds exception
reply
Add a review, comment
Other channel videos















