LEARNING JOURNAL

I created this learning journal to practice writting and to help me learn by writting everything down. Source code here

1/29/2024

Number of Equal Numbers Blocks

This is my solution for the** Number of Equal Numbers Blocks problem**.

The intuition here is to go over each element of the array nums, one by one. When you see the start element of a block, increase the number of blocks by one unit, jump to that element. Do the same thing until you reach the end of the array. The trick here is finding the fastest way to find the start element. We can use binary search for that, because it costs lgN time.