DEV Community

Paolo Ventura
Paolo Ventura

Posted on

100 algos in 100 days (Day 31)

[18/10]

Question

Image description

This was quite an easy and fun question which my TDD really helped with.
I actually didn't solve this with the O(1) time O(1) space solution but nonetheless really do understand the solution and have reproduced it.

The learning points are:

  • Think up and draw out all the possible cases. Like we did with the ways ranges can overlap. +++ Visualization is so important!
  • Use very specific and descriptive variable names. +++ I sometimes get too descriptive on these.

Top comments (0)