Round 1: CS and aptitude MCQs 30mins#
Above 7 CGPA CS, CS+AIML, ECE
- Pattern was +2 for right and -2 was wrong in CS section, +3 and -2 in the aptitude section. Generic CS MCQs easy level. Aptitude fkall bs.
Round 2: 2 leetcode questions (OA style) 30mins#
Shortlisted 269 from previous round
Happened in Lab rooms on their systems. There were 3 sets A, B, C. Each set had 2 leetcode questions, one easy & one medium.
Set A
- Q1. Longest Common Prefix (LC 14)
- Q2. Remove K Digits (LC 402)
Set B (I got)
- Q1. Find number of substrings of size k where the frequency of each charcter == 1
- Q2. Find the Next Permute (LC 31)
Set C
- Q1. Check divisibility by digit sum and product (3622)
- Q2. Partition String (LC 3597)
Here is my implentation/approach-
'''
PES2UG22CS281
M C KRISHNA KUMAR
SET B
q1. Find Special Substring of Length k
'''
s = "havefunon"
k = 5
'''
APPROACH: This can be done using sliding window and hash map
Time Complexity : O(N) # one loop
Space Complexity : O(N) # hashMap
'''
hashMap = {}
# For this we will make use of a window size of k
# Then as the window passes left to right incrememting by 1 we check if all the frequencies of the elements is 1
# If its not we can move to left side and recheck
n = len(s)
# base case
c = 0
if k < n:
return c
l = 0
for r in range(len(s)):
hashMap[s[r]] = 1 + hashMap.get(s[r], 0)
if len(hashMap) == k and all(hashMap.values() == 1):
c += 1
if hashMap[s[r]] > 1:
continue
if len(hashMap) > k: # means we are exceeding k len so remove left most
del hashMap[s[l]]
l += 1
print(c)
-----------------------------------------------------------------------------------------------------------------
'''
PES2UG22CS281
M C KRISHNA KUMAR
SET B
q2. Next Permutation
'''
nums = [1, 2, 3]
'''
APPROACH 1:
i) Jhonson Trotter Algorithm (generates all permutations)
ii) Manually get the next permutation
'''
'''
APPROACH 2:
i) Generate all permutations. [[perm1], [perm2]....]
ii) Sort them
iii) Iterate through the permutations
iv) Find the given nums and return the next value from the array of arrays
Time Complexity : O(n!) + O(nlon(n)) = O(n!)
Space Complexity : O(n)
'''
''' APPROACH 2 code '''
def NextPermute(nums: List):
res = []
perm = []
def dfs(i): # generates all permuations using backtracking
if len(perm) == len(nums):
res.append(perm.copy())
return
for i in range(len(nums)):
if nums[i] not in perms:
perms.append(nums[i])
dfs(i+1)
perms.pop()
dfs(0) # 0th index
# now the res will have all permutations
# sort it
res.sort()
for i in range(len(res)):
if res[i] == nums:
return res[i+1]
Round 3: Machine Coding 1hour#
Shortlisted 64 from previous round
This round assesses the candidate’s ability to solve a problem by developing a modular, project-like solution.
Prerequisites:
Candidates are free to use any coding language and any Integrated Development Environment (IDE).
Setup:
All required software and tools must be pre-installed and configured on the candidate's personal laptop before the round begins.
No additional time will be given for setup during the interview.
Restrictions:
All AI-powered tools and features within the IDE must be disabled.
Internet must be disabled.
The solution should focus on back-end logic; no front-end or database implementation is required.
- We were asked to do project based coding for the given requirement specification-




Here is my implementation (I could only do this much in an hour)-
from collections import defaultdict
import random
class ExpenseTracker:
def __init__(self):
# hashed for fast look-ups
self.persons = set()
self.groups = defaultdict(list) # (groupName, [person1, person2 etc])
def availableOptions(self):
print("1. Add people to the system")
print("2. List Registered users")
print("3. Create Groups")
print("4. Add to Group")
print("5. List Registered Groups")
print("6. Exit")
'''Seperate func as future hashSet can be changed to a real DB. Extensible'''
def _add(self, p):
if p not in self.persons:
self.persons.add((p, 0)) # initial balance is 0 for all
else:
print("User exists in the system")
def showBalance(self):
for person, balance in self.persons:
print(f"Balance of person {person} -> {balance}")
print()
def groupManagement(self, groupName):
if groupName in self.groups:
return "Group Already exists"
self.groups[groupName] = list()
print("successfully created group ")
def addPeopletoGroup(self, groupName, person):
if person in self.groups[groupName]:
return "Person exists in the group already"
self.groups[groupName].append(person)
def showRegisteredGroups(self):
for g in self.groups:
print(g)
def app(self):
print("Welcome to Expesne Tracker!")
person1 = input("Please enter your name admin ")
self._add(person1)
def main(self):
while True:
if len(self.persons) == 0: # implies first user
self.app()
self.availableOptions()
print()
option = int(input("Enter your option "))
if option == 1:
personName = input("Enter your Name ")
self._add(personName)
print("Successfully added\n")
elif option == 2: # list registered users
self.showBalance()
elif option == 3:
groupName = input("Enter the group name ")
self.groupManagement(groupName)
elif option == 4:
groupName = input("Enter the group name to add to ")
person = input("Enter the Person to add ")
self.addPeopletoGroup(groupName, person)
elif option == 5:
self.showRegisteredGroups()
elif option == 6: #exit
break
print()
class TransactionManager:
'''TransactionManager class inherits the ExpenseTracker class'''
'''Furthur maintains readability and extensibility'''
def __init__(self, groupName):
super().__init__(ExpenseTracker)
self.groupName = groupName
self.splitTable = defaultdict(list) # (id, groupName) -> [groupName, amount, descriptor, paidBy]
def addNewSplit(self, groupName, amount, description, paidBy):
_id = random.randint(1,9)
# amount is split equally among group members but not stored
amount / len(self.groups[groupName])
self.splitTable[(_id, groupName)].append([groupName, amount, description, paidBy])
def settleMent(self):
pass
# future implementation
# good coding practice
if __name__ == "__main__":
# for using first time
ExpenseTracker().main()
Round 4: Face to Face 30mins#
Shortlisted 21 from previous round
This round was a F2F interview. He first asked me how were the previous rounds and we discussed about my approach in Round2 and Round3. Followed with a resume based discussion. He asked me about my work in IBM. Then about docker and kubernetes (as one of my projects involved load balancer) differences and so on, then moved to DBMS. I was asked to write a SQL query based on 2 conditions and COUNT() aggregate funtion. Here my GROUP BY clause was on the wrong column rest was fine. I was asked differences between horizontal and vertical scaling with real world examples. I was also asked about redis and how i achieved fault-tolerance and failover, I spoke about the architecture I made use of i.e 3 redis sentinels + 3 redis server, then using a bash script to PING the master at certain intervals if PONG is not received we can say master is down and elect a new one. More about kuberneterand pod scaling and how scaling cannot be achieved well with just Docker. I was also asked what is Spring MVC and why we should use it (generic question)
For the DSA part i was asked given a 2D matrix of 1s and 0s find the logest connected 1s.
1 1 0 0
1 0 1 1
1 0 1 0
0 1 0 0
OP: 4
Approach I came up with was a DFS based approach similar to LC200, He didn’t say anything during the interview. I asked him about my approach and later found out expected way was to use a dp table and use previous computations.
Round 5: Face to Face 30mins#
Only for those who were asked to stay back
Another F2F interview. He asked me real world use cases of dp. I told him about caching and git uses memoization under the hood. Then about Docker and K8s discussion, he asked me what is the point of shortening an URL. My response was its not always convinient to copy long form URLS for example if u copy Amazon product URL directly from web address bar its going to be very long. Adding on this to I told how you can generate ad-revenue using url shortners.
He asked me about Redis nothing specific as such, I told him Redis full-form and how it is super fast in-memory db (cache) then how I used it and how else it can be used (Redis can also be used as pub-sub model btw).
We have Contacts app in our phone, when we search for 93 we get all the occurrences of 93XXXXX how is this achieved, don’t use HashMap as size would be too huge.
Click to reveal spoiler
My response was use a Trie and showed him diagramatically how it can achieved
He was satisfied with this.He randomly opened my GitHub and asked me about DBMS project (BMTC Bus Querying). I was able to explain it to him.
For the DSA part he asked me Coin Change LC322. Before I started with the dp approach, I told him that greedy wouldn’t work he asked me for a test case to prove it.
denominations = {1, 3, 4} amount = 6
Here being greedy won’t help as OP will be- [4, 1, 1] while right answer is [3, 3]
Moving to the dp approach (top-down) while I started writing pseduo-code he was able to figure out I can do this with ease and just told okay and moved to next question.
Interviewer was a pretty fun guy vibed about being JEE Failures๐ญ

