# How to crack SDE-2 interview at Paypal!

1. Graph Algorithms — Prims and Kruskals
Gave him an abstract idea of both and told the difference. Thought he would ask me to code both, but we just discussed about it and moved on to next.
2. Sum of two singly Linked lists — Given two linked list with each representing a number and asked to output a new linked list which holds the sum of two numbers. He asked me to write the code in an online compiler and execute it.
Provided a O(n) stack solution for this question and executed it. He was convinced and then went to ask few questions about time and space complexities for a while.
3. Heap sort
He asked to analyse and explain heap sort with time and space complexities. We fully traced the algorithm. As it was one of my favourite algorithms, was able to give a quick solution.
4. Problem related to isomorphic strings.
Was asked to code in an online compiler and execute. Requested him to rephrase the question and asked my doubts on inputs. He was patient enough to explain it well again. Then I gave a O(n) hashmap solution and he was satisfied.
5. Difference between recursion and backtracking.
He expected me to tell the slight difference between the two. I was able to tell it.
For Ref: https://stackoverflow.com/questions/26670757/difference-between-backtracking-and-recursion/26671095
6. Internal working of a hashmap
Explained it using Array of linked list concepts. Also collision cases when putting values in hash map were also asked.
7. Singleton Pattern with example scenarios were asked. Gave few simple ones. He was convinced.
8. Atlast, a puzzle was asked. I was tired as it had already been two hours since the interview started. Couldn’t give the best solution in this round. Tried to give an almost good solution and he was satisfied.
https://en.wikipedia.org/wiki/Wolf,_goat_and_cabbage_problem#:~:text=On%20his%20way%20home%2C%20the,goat%20would%20eat%20the%20cabbage
.
1. Asked about the database architecture which I was working in my previous company. As it was a relational DB, questions were based on sql, table joins, etc..
1. A stream of strings from newspaper is coming and we have to find all unique strings and their count simultaneously.
Suggested a trie solution for this question. Then the same question was improvised. Gave a solution for that by adding parameters in each trie nodes. The interviewer was convinced.
2. Asked about my work culture, the hardest problems I’ve faced in my previous job, etc. Able to give an articulated answer for these question as I’ve seen such question in many blogs and mentally prepared answers for those too.
3. Asked about the technologies used in my previous company. The interviewer dived deep in ajax, web-services, Rest API’s and caches. I was able to answer it because I’ve already worked in all these techs.
1. Practice enough problems in data-structures and algorithms. Leetcode — Discussions page is a gold mine, you can utilise it well. Different way of solving a problem can be analysed well from there. It’ll be helpful in approaching other problems as well.
2. Stick to any one programming language. Better to pick Java or C++ because most of the interviewers know these well. If other languages are used, we may not able to convey our thinking pattern well in the interview.
3. Do competitive coding only if you like it. Never do it to get placed in FAANGM or other tier 1 companies. Only practicing data structures, algorithm and system design will be sufficient for getting an offer from these companies.
4. Think loudly during the interview. By doing this, our thinking pattern will be clear to the interviewers. So, they can give hints accordingly. Also our communication/socialising skills will be known to them which most of the companies consider vital.

--

--

--

## More from Giridharan Shanmugavel

Oracle certified Java Prof | SDE-2 @Paypal

Love podcasts or audiobooks? Learn on the go with our new app.

## Giridharan Shanmugavel

Oracle certified Java Prof | SDE-2 @Paypal