4
votes
Accepted
Finding missing numbers in ranges
The primary problem with your current approach. As you know from previous
answers and comments, the limitation of your current approach is that it
falters when faced with very large intervals, which ...
2
votes
Accepted
Given a sorted list of integers, find the highest count of elements between an indeterminate but fixed size range
Inappropriate use of iteration functions
Complexity
When the data is sorted it is a sure sign that there is a solution with less complexity than \$O(n^2)\$
The use of 'Array.reduce' and ...
1
vote
Given a sorted list of integers, find the highest count of elements between an indeterminate but fixed size range
I'd establish a base line implementation for correctness tests and performance using the most simple approach to conceivably do. (For me, that would be initialising a start of range to start of list ...
1
vote
Finding missing numbers in ranges
I like the fact that you thought to use a set for your current approach. That is typically the right data structure for "Have I seen this before?" type questions, and is actually doing a lot ...
1
vote
Finding missing numbers in ranges
I think the complicating factor here is that most of these operations on individual intervals can return multiple intervals back to you, which can be tricky to work with.
I'd probably start by ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
interval × 155python × 40
datetime × 32
java × 30
c# × 29
algorithm × 24
performance × 20
c++ × 16
programming-challenge × 15
python-3.x × 13
interview-questions × 11
javascript × 10
array × 7
iterator × 7
php × 6
c++11 × 6
object-oriented × 5
sorting × 5
excel × 5
time-limit-exceeded × 5
validation × 5
linq × 5
integer × 5
vba × 4
tree × 4