🏆 Online Coding Round
Total Questions: 4
📝 Problems Given:
-
Prime Number Cost Problem:
- Given an array of numbers () and a cost array (code
1Arr), each number must be formed by summing a single prime number multiple times.code1Cost - The cost of using a prime number times iscode
1x.code1x * Cost[i] - Example:
- ,code
1Arr[i] = 10code1Cost[i] = 6 - → Cost =code
15 + 5 = 10(Minimum cost).code12 * 6 = 12
- Given an array of numbers (
-
Max GCD Sum Problem:
- Given an array of positive integers, find the maximum sum of for all adjacent pairs.code
1GCD(arr[i], arr[i+1]) - You may rearrange the array in any order.
- Given an array of positive integers, find the maximum sum of
-
Function Dependency Execution Count:
- Given an array representing dependencies of functions.
- Example: code
1{ -1, -1, 1, 1, 3 }- The 1st & 2nd functions execute anytime ().code
1-1 - 3rd & 4th execute after the 1st.
- 5th executes after the 3rd.
- The 1st & 2nd functions execute anytime (
- Find total number of ways to execute all functions.
-
Max Group Selection:
- Given two arrays (andcode
1A), select elements forming the largest possible group.code1B - Rules:
- If element is chosen, include at mostcode
1i-thelements beforecode1A[i].code1i - Include at most elements aftercode
1B[i].code1i
- If
- Example:
- ,code
1A = { 1, 2, 0, 3 }code1B = { 2, 2, 0, 1 } - Maximum elements in a group = .code
13
- Given two arrays (
- Solved 1st problem completely and 2nd problem partially.
- Got shortlisted for the second round along with 10 other applicants.
⚡ First Technical Interview Round (30–35 min)
🔹 Questions Asked:
-
Maximum Subarray Sum of a Circular Array:
- Array can contain positive & negative elements.
- Example:
- → Answer = 6.code
1Arr = { 2, -4, 3, -5, 1, 3 }
- Progressed from brute force → optimal (O(n)) approach.
- Dry ran multiple cases → Interviewer was satisfied.
-
Diameter of a Binary Tree:
- Initially unaware of this.
- Interviewer explained the concept.
- Asked to write pseudo-code for diameter of an N-ary tree.
- Solved in O(n) time.
🚀 Second Technical Interview Round (40 min)
🔹 Questions Asked:
-
Chocolate Bar Distribution:
- Given chocolate bars of varying lengths.code
1N - Can split bars but NOT attach them.
- Distribute them to students such that each gets equal length.code
1K - Find max possible length per student.
- Approach: Binary Search on Answer → .code
1O(n log n)
- Given
-
Swapped Nodes in a BST:
- Given a BST where two random nodes were swapped.
- Find and fix those nodes.
- Solved in O(n) time.
- Dry ran multiple cases → Interviewer was satisfied.
🎯 Third HR Interview Round (40 min)
🖥️ Topics Discussed:
-
Computer Networks:
- How data packets travel.
- How HTML, TCP/UDP work.
- Where & how code gets stored & executed.
- Interviewer helped wherever I got stuck.
-
OOP & Inheritance:
- Diamond problem in OOP.
- Behavior of protected & private members in inheritance.
🧩 Puzzles Asked:
-
Finding the Faster Mouse:
- 12 identical mice → 1 is faster.
- 4 cakes available.
- Mice can pause/resume eating, can be rearranged anytime.
- Find the faster mouse.
- Solved independently.
-
Fixing Wrongly Labeled Containers:
- Containers labeled Red, Green, Red+Green but wrongly placed.
- Balls inside contain only Red, only Green, or both.
- Find correct labels with minimum ball picks.
- Solved using 2 balls → Optimized to 1 ball with hint.
🎉 Verdict: Got Selected! 🎉
- After 30-minute wait, they felicitated us with goodies.
- 4 applicants made it to the final selection list.
🔥 Conclusion
- A dream come true! 💫
- Competitive Programming played a major role in my selection. 🚀