dsa1 min read
Count Negative Numbers in Sorted Matrix — Row Binary Search
Count negatives in a sorted matrix in O(m+n) using the staircase approach or O(m log n) with binary search per row.
Read →
webcoderspeed.com
1276 articles
Count negatives in a sorted matrix in O(m+n) using the staircase approach or O(m log n) with binary search per row.
Check if a number is a perfect square in O(log n) using binary search or by exploiting odd-number sum identity.
Find the smallest letter in a circular sorted list that is greater than the target using left-boundary binary search.
Answer election queries for who is leading at time t by precomputing the leader at each vote and binary searching.
Find the duplicate in array of n+1 integers in [1,n] using binary search on value with count-of-smaller logic.