1146. Snapshot Array
Implement a SnapshotArray that supports the following interface: - SnapshotArray(int length) initializes an array-like data structure with the given length. Initially, each element equals 0. - void set(index, val) sets the element at the given index to be equal to val. - int snap() takes a snapshot of the array and returns the snap_id: the total number of times we called snap() minus 1. - int
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start