Find Right Interval | LeetCode 436 | C++, Java, Python

  Рет қаралды 7,716

Knowledge Center

Knowledge Center

Күн бұрын

Пікірлер
@mahmoudtarek6859
@mahmoudtarek6859 4 жыл бұрын
the way you convert from c++ to java to python is great.. people who get the idea and go away miss a priceless show.. XD
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
😂
@sudhirshinde2036
@sudhirshinde2036 4 жыл бұрын
A small suggestion:) we could have used only vector sorted, as we will not require the endpoint of the interval anywhere in the binary search, btw thanks for the daily videos!
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Good point!
@crankyinmv
@crankyinmv 4 жыл бұрын
Thanks as always. I had the idea to sort and store the original indices, but didn;t think to follow up with a binary search. A possible optimization would be cache by endpoint.
@RishiRaj-dl1mg
@RishiRaj-dl1mg 4 жыл бұрын
Sir i didn't get the last part of binary search...how did sorted[l] is returned at the end . Can you please explain?
@0anant0
@0anant0 4 жыл бұрын
Thanks! Can we use a hashmap: interval -> ori idx (as you have mentioned), and then save all intervals to a TreeMap/TreeSet and then use ceiling(end_time) for each interval?
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Yep. That should do.
@hardikpatel352
@hardikpatel352 8 ай бұрын
Thanks a lot
Implement Rand10() Using Rand7() | LeetCode 470 | C++, Java, Python
10:43
Time Based Key-Value Store | Leetcode 981
21:13
Knowledge Center
Рет қаралды 1,7 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
What I Learned About Django Views That Got Me Hired
22:31
Nehemiah Kamolu
Рет қаралды 24
This AI Robot Is Doing the Impossible - Unitree x ElizaWakesUp
9:30
AI Revolution
Рет қаралды 162 М.
Race Car | Leetcode 818 | C++
30:26
Knowledge Center
Рет қаралды 4,3 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН