dsa1 min read
Check If N and Its Double Exist — Binary Search or Hash Set
Check if any element and its double both exist in an array using a hash set or sorting with binary search.
Read →
1575 articles
Check if any element and its double both exist in an array using a hash set or sorting with binary search.
Implement get(key, timestamp) using binary search on stored sorted timestamps for O(log n) retrieval.
Maximize events attended by greedily attending the event with the earliest end date each day using binary search.
Find the kth smallest element from two sorted arrays in O(log(m+n)) using binary elimination of k/2 elements per step.
Find the minimum train speed to arrive on time given n rides (last ride doesn't wait) using binary search on speed.