You, leetcode
Back

57. Insert Interval

The finished form of the program isn't too bad, but it was really ugly for about an hour until I figured out what I wanted to do.

Something new I'm trying is to comment what invariants I can count on at various points in the code. It has helped me keep my thinking straight.

The code listing and forum post are here:

https://leetcode.com/problems/insert-interval/discuss/2121263/Java-2ms-beats-72-very-clear-code-lots-of-comments-easy-to-follow