dsa2 min read
Longest Consecutive Sequence [Medium] — HashSet O(n)
Find the longest consecutive integer sequence in O(n) using a HashSet and only extending sequences from their start.
Read →
webcoderspeed.com
1276 articles
Find the longest consecutive integer sequence in O(n) using a HashSet and only extending sequences from their start.
Partition a string into the maximum number of parts where each letter appears in at most one part, using last occurrence mapping.
Calculate minimum CPU intervals for tasks with cooldown using a greedy formula based on the most frequent task count.
Find the minimum arrows needed to burst all balloons arranged as intervals using a greedy sort-by-end approach.
Maximize a number by making at most one swap, using a last-occurrence map to find the optimal swap greedily.