medium10 pts · first answer countshash-mapsets
Longest consecutive run in O(n)
For [100, 4, 200, 1, 3, 2], the longest run of consecutive integers is 1, 2, 3, 4. With a Set, which rule keeps the algorithm O(n)?
Discussion 0
Join free to post in the discussion.
Related questions
- Average cost of a hash map lookupBackend Developer
- Worst case for a hash map lookupBackend Developer
- Removing duplicates with a SetBackend Developer
- Number keys in a plain objectBackend Developer
- Iteration order of a MapBackend Developer
- When to choose Map over a plain objectBackend Developer
- Set of look-alike objectsBackend Developer
- Counting letters in a wordBackend Developer