Initial 10-15 mins revolved around my current and past experience, which was followed by 2 questions:
This was followed by coding questions, the interviewer directly shared the leetcode question link and asked me to share my screen. He checked if I had already solved the question or not from my submissions tab.
Question 1: https://leetcode.com/problems/integer-to-roman/
Question 2: Based on continuous data stream
Given a stream of data coming from an online game portal, every entry looks like this
User_id, timestamp, score
U1, 12:00, 2
U2, 13:00, 3
U1, 13:02, 2
U2, 13:06, 1
U3, 14:03, 4
Need to figure out the sum of scores in the last one hour(Current - 1hr)
Solution - LinkedList
Result = 0
while currTime - currReverseNode.time < 1hr
Result += currReverseNode.score
currReverseNode = currReverseNode.prev
Return result60 min array approach
TC = SC = O(1)
Obj = {
timeStamp: “”,
Score: 0
}
DbMinuteWise = [Obj,,.....Obj] // 60 Obj
Const insertData = (userId, timeStamp, score) => {
If timeStamp == DbMinuteWise[59].timeStamp:
DbMinuteWise[59].score += score
return
DbMinuteWise.pop(0)
DbMinuteWise.push({ timeStamp, score })
}
Const sumOfScore = () => {
result = 0
for obj in DbMinuteWise:
if obj.timeStamp - currentTime <= 60:
result += obj.score
return result
}Solutions for both the questions were satisfactory.
Got ghosted by recruiter did not receive calls for further rounds.