Screening Round: You are given a connected graph, and you need to find all the critical edges. A critical edge is one that, if removed, would divide the graph into two disconnected components.
My Approach: I solved it using a standard bridge-finding algorithm to identify the critical edges.
Verdict: Passed.
Round 1: LeetCode - Super Pow - exactly the same problem
Approach: I solved the problem using the Euler Totient function. just this piece of code
int superPow(int a, vector<int>& b) {
int modValue = 1140, exp = 0;
for (int digit : b) exp = (exp * 10 + digit) % modValue;
return binExp(a, exp ? exp : modValue, 1337);
}The interview wrapped up quickly, in just about 20 minutes.
Verdict: Strong hire.
Round 2: You are tasked with writing a sequence of positive integers starting from 1. However, you have a constraint: for each digit (0-9), you can press its corresponding key a maximum of n times, where n can be as large as a 64-bit integer. You need to determine the last number you can write before running out of allowed presses for any digit.
Example:
For n = 5, the last number you can write is 12. You can write numbers from 1 to 12, but to write 13, you would need to press the '1' key for the sixth time, which exceeds the limit.
Approach: It was a familiar problem, so I solved it quickly, although I pretended it was new to stretch the interview a bit. The entire round took about 30 minutes.
Verdict: Strong hire.
Round 3: You are given a grid of cells with R rows and C columns. Initially, each cell contains a non-negative integer (starting as 0). You can perform two operations:
Approach: I took around 30 minutes to discuss and fully understand the problem. After that, I wrote the solution using a randomized binary search tree and dry-ran the code, completing the task in about next 20 minutes.
Verdict: Hire.
Final Verdict: On hold