i to 0 and ans to 0.nums.size() and store it in size.i is less than size:
a. Retrieve the value at index i using nums.at(i) and store it in x.
b. Initialize di to 2 (the initial step size for exponential search).
c. Calculate the remaining size of the array from index i as size - i.
d. While di is less than the remaining size and the value at index i + di is equal to x, double di.
e. Perform a binary search between i + (di // 2) and min(i + di, size) to find the first index where the value is not x.
f. Update i to the index found by the binary search.
g. Increment ans by 1.ans as the number of blocks.