Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Monday, Dec 7.Claim the deal

(This question is a variation of the LeetCode question 251. Flatten 2D Vector. If you haven't completed that question yet, it is recommended to solve it first.)

Design an iterator to flatten a 2D vector so that all its integers can be accessed sequentially, row by row. In addition to standard iteration, the iterator must support removing the last returned element and provide access to the snapshot of the current vector state after any number of removals.

Implement the Vector2D class:

Test Cases
Input
Output
Expected