Counting-Sort
LeetCode 1833: Maximum Ice Cream Bars
·2 mins
LeetCode
Medium
Greedy
Sorting
Counting-Sort
LeetCode 1833 note: buy the cheapest first; the problem asks for counting sort, and with values up to 10^5 each price buys min(count, coins // price)
LeetCode 1122: Relative Sort Array
·1 min
LeetCode
Easy
Array
Hash-Table
Sorting
Counting-Sort
LeetCode 1122 note: count first, emit values in arr2’s order, then append the remaining values in ascending order
LeetCode 1051: Height Checker
·1 min
LeetCode
Easy
Array
Sorting
Counting-Sort
Bubble-Sort
LeetCode 1051 note: sort and count the positions that differ from the original
LeetCode 561: Array Partition
·1 min
LeetCode
Easy
Array
Greedy
Sorting
Counting-Sort
LeetCode 561 note: sort and pair neighbors; each pair’s minimum is the element at an even index, so sum those