Thank you, Michael! I really appreciate how you break down complex concepts into simple, easy-to-understand terms. Your explanations are always clear and concise. Keep up the fantastic work, and I hope your audience continues to grow!
@joshuaalonge13513 жыл бұрын
This is the best explanation that I have seen for this question. Good one
@satang5002 жыл бұрын
Thanks for your explanation with the drawing and image which really helps. I watched other videos, but didn't fully understand until I watch yours. :)
@shrimpo64162 жыл бұрын
Great explanation!!!! Excellent!!!
@mikasaackerman26944 жыл бұрын
Very clear explanation! I've watched some of your other videos too. You definitely deserve more subscribers.
@AlgosWithMichael4 жыл бұрын
I appreciate that!
@ninehoursful4 жыл бұрын
How can someone come up with such a solution in an interview situation if they haven't seen this question before? I tried to solve it myself for 12 hours but I couldn't solve it! This is just scaring me
@AlgosWithMichael4 жыл бұрын
Once you see how a problem is solved, you can solve other problems that are similar. It is just about having the general idea, so don't feel bad if you can't think of it the first time you see this type of problem. Keep practicing and it will get easier
@ninehoursful4 жыл бұрын
@@AlgosWithMichael Thanks for the kind words. My problem is even if I see/have done the question, I forget the process/tricks used to solve the questions. How do you overcome that?
@AlgosWithMichael4 жыл бұрын
Yea, it can be tough. What I think you should do so it is remembered easier is study one topic for many days in succession. So for example, if you feel you are not good with sorting questions, just practice sorting questions / topics for a week straight instead of jumping from trees to graphs to anything else etc. It will stick much better that way
@andrejoljaca35773 жыл бұрын
So good at explaining! Incredible
@AlgosWithMichael3 жыл бұрын
Thanks! 😃
@SheikhSadiruddin14 жыл бұрын
Awesome explanation Michael! I love the way you explain complex things in a simple manner. Keep up the good work. I hope you you get more subscribers.
@AlgosWithMichael4 жыл бұрын
Thank you very much!
@chaoschao94324 жыл бұрын
deserve more subscribers. good job.
@AlgosWithMichael4 жыл бұрын
I appreciate that, thank you!
@symbol7672 жыл бұрын
Great solution, thank you
@AlgosWithMichael2 жыл бұрын
You bet
@sarvesh974 жыл бұрын
Amazing explanation! 🔥
@AlgosWithMichael4 жыл бұрын
Thanks so much!
@kishorshinde55674 жыл бұрын
Thanks for sharing this problem with solution. After you video, I thought instead of looping 1440 times, we can loop 2*input array times and came up with below solution. public static void main(String[] args) { // TODO Auto-generated method stub String []arr = new String[] {"01:00","03:00","23:30"}; int[] times = new int[arr.length]; int k=0; for(String s : arr) { String hour_Min[] = s.split(":"); int h = Integer.parseInt(hour_Min[0]); int m = Integer.parseInt(hour_Min[1]); times[k++] = h *60 + m; } System.out.println(); display(times); int min = Integer.MAX_VALUE; for(int i=0;i
@AlgosWithMichael4 жыл бұрын
Ah I like that approach 👍
@heisenberg18444 жыл бұрын
Nice. Can you please elaborate the wrap around part(1440-cur-first) a little more? Thanks.
@AlgosWithMichael4 жыл бұрын
Sure. 1440 is the total amount of minutes in a day. Thus, we subtract cur which accounts for the "ending" of the first day, then subtract first which accounts for the "start" of the second day. Hope that makes sense for you!
@ShashwataSaha3 жыл бұрын
This gives better time complexity. from sys import maxsize class Solution: def findMinDifference(self, timePoints: List[str]) -> int: for x in range(len(timePoints)): hr,mi=map(int,timePoints[x].split(":")) hr*=60 timePoints[x]=hr+mi timePoints.sort() mini=maxsize for x in range(len(timePoints)-1): temp=abs(timePoints[x]-timePoints[x+1]) mini=min(mini,temp) mini=min(mini,(60*24-timePoints[-1])+timePoints[0]) return mini
@AlgosWithMichael3 жыл бұрын
nice
@Kacperak234 жыл бұрын
Isn't that more like the counting sort? You have 1-1 relationship in your buckets, but usually buckets have many items inside of them which you sort normally.
@AlgosWithMichael4 жыл бұрын
it is similar to counting sort yea
@rohanangajala5483 жыл бұрын
What was the point of creating buckets and have all the false values? Isn't this essentially the same as just iterating through the array and keeping track of all the different pointers?
@AlgosWithMichael3 жыл бұрын
Since the size of our buckets is always the same, it is technically constant space :)
@michaelroatis68742 жыл бұрын
About the time complexity, can we say constant time since its bound by the number 1440? bucket.length in the second loop is always 1440, and if we have more than 1440 timePoints we'll always return 0 in the first for loop