Fix segv: stop using iterator on mutated deque
Previously the code has segmentation fault during one of the solutions (not every one). This was because when an item is inserted into the deque, iterators are invalidated. Incrementing the iterator causes undefined behavior, which somehow worked until that point in the program but not afterwards. We have changed to use index instead of iterator on the deque.
Loading
Please register or sign in to comment