Round 1 : OA
There were 2 questions (med-hard ) level , had to solve in 90 mins.
Dont remember the questions right now.
Further Rounds happened on same day after 3 weeks.
Round 2: DSA Round
Q1:
Candy crush stack based question on strings.
string gives s = "abccbd"
maximum twice the chars can occur .
first all c will popped up continously, and then leftover string abbd,
now bb will be popped up
Follow Up question: Multiple chars , how we will handle in stack (just asked approach and dry run)
I mentioned stack based approach for first
for second, mentioned to store the count of consecutive elements in stack or stack of pair with the indexes, keep on adding and removing the simultaneous ones.
Wanted the coding only for the first questions, which is just normal stack and passed all cases.
Q2:
Multithreaded Counter
Implemented get, put functions with proper Class structure.
Used mutex and further discussed shared mutex as well for multiple readers and one writer at a time.
Round 3: System design
Asked traffic logging system which was from the Resume (get hands-on of all resume projects) , mostly they ask design questions from Resume.
Went with the FR AND NFR.
High level architecture diagrams
Handling unique log messages through Kafka(why kafka used)
Handling Idempotency
Database selection (Tine series vs others)
**Round 4 : DSA Round **
Q:
given strings , implement the lock and unlock functions, shared prefix strings cant be locked again until unlocked , once unlocked can be locked again.
Eg:
lock s1 = "abc" (return 1 for locked)
lock s2 = "def" (return 1 for locked)
lock s3 = "abz" (return 0 for this as its prefix already locked)
unlock "abc" -> return 1 unlocked
lock "abz" -> now can be locked , return 1
Gave brute force approach of looping everytime over the vector of all locked strings and checking every string for the prefix .
Optimised using Trie :
Stored strings in prefix tree and then based on prefix present , returning the status efficiently.
Optimised the deletion part of nodes when the strings got unlocked by having a boolean flag is_locked in each node for the strings.
Discussed TC and SC.
Follow to make it Multithreaded:
Applied same approach of mutex and shared mutex.
unique_lock and shared_lock , using lambda functions efficiently
Used condition variables for notifying the other threads .
Got a call for HM Round :
Round 5: HM Round
Went for almost 30 mins
Some behavioral questions asked , previous projects on resume,
Some discussion on Horizontal vs Vertical scaling and System design knowledge.
Verdict:
Selected (Got a offer after 3 weeks of wait)