Problem statement:
Suppose you are working on Google Photos. you are wring the client application. Request comes to you to upload N photos. you fire the request to server to upload those N photos to server. Then the server responds back with acknowledgements that a particular photo is uploaded.
Example. Suppose you are uploading 10 Photos, The server can respond back in any order, such as 1,2,4,5,3,7,6,10,9,8 . Now at any given point of time we need to check what is the maximum photo number which has been uploaded continously.
Example.
ack(1),
getMax()-> returns 1, because the maximum photo uploaded is 1
ack(2),
getMax()-> returns 2, because the maximum photo uploaded is 2
ack(4)
getMax()-> returns 2 only because 3 has not been recieved yet
ack(5)
getMax()-> returns 2 again because 3 has not been recieved yet
ack(3)
getMax()-> returns 5 because we recieved 3 and 4 and 5 also we recieved eralier. using this example you have to complete the following class
public class PhotosClient {
// initializer
public PhotosClient(int n) {
}
// this method is called each time you receive acknowledgement forom the server
public void ack(int x) {
}
// this method will be called in between to check what the maximum photo number has been uploaded successfully
public int getMax() {
}
}Complete Interview Experience Here
https://leetcode.com/discuss/interview-experience/2072074/Google-or-Software-Engineer-L3-or-Banglore-or-May-2022-Reject