Hello folks ,
As prestigious and amazing google sounds, its interview sounds that scarely and difficult. Why not to fix that , even better giving it a try to make you fall in love with coding .
So here's my topic wise questions and what i learned new from each topic. After doing these, I believe whenever you are asked a question you will have some good insight plus intuitive thinking
So First :-
1. Arrays :
- implement-quicksort : https://leetcode.com/problems/sort-an-array (Partition). : This can be the solution for Kth smallest element
- Largest Contiguous Sum : https://workat.tech/problem-solving/practice/largest-contiguous , Sliding window will fix this.
- Matrix Rotation : https://workat.tech/problem-solving/practice/matrix-rotation : Please try to do this in O(1) space only .inplace . (Reason for inplace is interviewer will ask for this only).
- Inversion Count: ( https://workat.tech/problem-solving/practice/inversion-count ) Mostly not asked but its better to know this. merge sort based.
2. Two Pointers Approach :
- Unique-elements-sorted-array : https://workat.tech/problem-solving/practice/unique-elements-sorted-array . Again two pointers helps inplace.
- Trapped-Rain-water : https://workat.tech/problem-solving/practice/trapped-rain-water : Classical question for FAANGS
3. Stacks & Queues:
- Implement Queue using stack : https://workat.tech/problem-solving/practice/implement-queue-using-stacks
- Implement Stack using Queue : https://workat.tech/problem-solving/practice/implement-stack-using-queues
4. Backtracking:
- Subset: https://leetcode.com/problems/subsets/ (Please look through the run time for the algorithm , backtrack problems have a template so better to get time complexity and understand, how its O(2^n) or O(n!).
- Combinations Sum : https://leetcode.com/problems/combination-sum-ii/ Good question to know how to modify the template for this use case. Again saying ! do understand the time complexity for this.
- LetterCombinationOfPhoneNumber : https://leetcode.com/problems/letter-combinations-of-a-phone-number Another beautiful question and with this check this solution to and check the code clarity here .
- Pallintrome Partitioning : https://leetcode.com/problems/palindrome-partitioning/ , Do compute the time complexity and make sure you understand why its O(2^n).
5. Stack & Queue
Bonus :
Implement hashMap , follow up questions : what is the load factor , java 8 improvement in hashmap and implement it in 30 min. Suggested : See java 8 class implementation and how they did. I did it ( https://github.com/terror26/HashMapImplementation) .
- Implement Min Stack : https://workat.tech/problem-solving/practice/min-stack : Required : O(1) pop, push , peek.
- Largest Rectangle in histogram : https://workat.tech/problem-solving/practice/largest-rectangle-histogram : Hard question so better to give your best shot and then retry . O(n^2) should be done. O(n) required.
- Next Greater Element: https://leetcode.com/problems/next-greater-element-i/description/ : Now do it in O(n) Space complexity . There are further questions on this with modification so you can try those too.
- Trapping-Rain-Water : https://leetcode.com/problems/trapping-rain-water/ , Now i expect you to brute force this in O(n^2) but efficient solution is of O(n) so try to do in that.
* Sliding-Window-Maximum : https://leetcode.com/problems/sliding-window-maximum/ , Amazing question to know about the Data structure usage.
6. Binary Search Tree and Heaps
- Inorder , preOrder and PostOrder : Note recursion one is fine but try to implement this using the stacks.
- LCA : Lowest common Ancestor: https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/ , Pretty popular question and must to have its good understanding.
- Kth largest data in a Stream: https://leetcode.com/problems/kth-largest-element-in-a-stream/ . Space complexity for each query : O(k), time Complexity O(logK).
- Sort Almost Sorted Array : https://www.geeksforgeeks.org/nearly-sorted-algorithm/ , Do work your way to the optimal solution.
Will add more to the list with time. :)
Comments