https://app.codility.com/programmers/lessons/15-caterpillar_method/min_abs_sum_of_two/
- Usage of
ArrayDeque - Try to use
addFirst(),addLast(),peekFirst(),peekLast(),pollFirst()as they have clear behaviour - Construction of the while loop
- Use peek and poll/pop in different places
- Run through an example in your head about what happens when a becomes empty
- Where in the loop will it happen
- How will the loop continue after
- Here, the stop condition was either queue becoming empty.
- Accounting for extra edge cases before starting the loop
- i.e. lowest +ve * 2 or lowest -ve * 2