ThoughtSpot Interview Question

Versioning using stacks and solve get version with O(1) complexity