MCQs:


Coding Question 1:
The question was about checking if the given sequence of events is valid. The conditions are:
The order of release should be reverse of aquiring(stack)
A locked lock can not be aquired again
A lock has to be locked before releasing
There should be no dangling locks
// Complete the check_log_history function below.
static int check_log_history(List<String> events) {
HashSet<Integer> hs = new HashSet();
Stack<Integer> st = new Stack();
for(int i = 0; i < events.size(); i++){
String e = events.get(i);
String name = e.split(" ")[0];
int num = Integer.parseInt(e.split(" ")[1]);
if(name.equals("ACQUIRE")){
if(hs.contains(num)){
return i+1;
}
st.push(num);
hs.add(num);
}else{
if(!hs.contains(num) || st.peek() != num){
return i+1;
}
st.pop();
hs.remove(num);
}
}
return st.empty() ? 0 : events.size()+1;
}Coding Question 2:
Number Score:
V1: https://leetcode.com/discuss/interview-question/390058/pure-storage-oa-2019-number-score
V2: https://leetcode.com/discuss/interview-question/406130/Pure-Storage-or-OA-2019-or-Number-Score-V2