All Posts

1276 articles

dsa2 min read

Relative Ranks

Assign gold/silver/bronze or rank numbers to athletes based on their scores using sorted ordering.

Read →
dsa3 min read

Find K Closest Elements

Find K closest elements to x in a sorted array using binary search to find the optimal left boundary.

Read →
dsa2 min read

Top K Frequent Elements

Return the K most frequent elements using a frequency map plus min-heap, or bucket sort for O(n) solution.

Read →
dsa1 min read

Sort Characters By Frequency

Sort characters in a string by decreasing frequency using a frequency counter and max-heap or bucket sort.

Read →
Page 67 of 256