keshavMM004 / keshavMM004/InterviewQuest

GOOGLE interview question

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
hacktoberfest
Dominant language
Java
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Design a SnapshotArray that provides the following functionality:

SnapshotArray(int length): Initializes an array-like structure of the given length, with each element initially set to 0.
void set(int index, int val): Updates the element at the specified index to the given value.
int snap(): Captures a snapshot of the current state of the array and returns the snap_id, which is the number of times snap() has been called, minus 1.
int get(int index, int snap_id): Returns the value at the specified index at the time the snapshot with the given snap_id was taken.

[leetcode](https://leetcode.com/problems/snapshot-array/description/)

Contributor guide

Open the contributing guide

Research direction

The issue provides the complete SnapshotArray API and links to the LeetCode problem; start by locating the repository's Java source entry point. Done means supporting the stated constructor, set, snap, and get behavior for snapshot IDs.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.