Implement a balance tracker and interval merger | Rippling Interview Question