Problem-Solving + Data Structures and Algorithms
Those who are still student, I urge you to practice problem solving as much as poosible. It's not just for freshers, even mid/senior positions have problem solving round too.
If you are already quite good at problem solving, Congratulations!
This section is designed for who are not much experience in problem solving, and we will try to give concise, achievable guideline to prepare for interviews.
Being capable of solving upto 1200-1400 rated problems on CodeForces is good enough for most companies. But as the competition is huge in the market, being better at problem solving will give an edge specially if the first round is contest based (i.e. Brain Station 23)
There is not much shortcut to be better at problem solving, it's somewhat long term game. Practicing regularly is the best way to improve. But there are some tips that can help you to improve faster, and somethings to avoid.
Problem-Solving
Tips to improve problem solving skills
- Solving easy problems won't teach you much, hard problems might be beyond your scope, so choose problem with rating slightly higher than your current level. (Try to solve 1300 rated problems when you are 1200)
- Really try to solve the problem for 20-30 mintues (or depending on the difficulty)
- If you are stuck, try to solve a simpler version of the problem.
- If unable to solve, try to solve by reading editorial.
- Looking at solution should come last.
- Even you look at the solution, try again by yourself, don't dismiss it thinking its too easy or ignorable
- If you see new tricks/algorithm, learn that immediately
Things to avoid
- I've seen so many students keep solving easy problems and think they are progressing. Solving 100 easy problems will give you the illusion and satisfaction of progress and productivity when actually you are just wasting time.
Data Structure and Algorithms
- Learn the basic data structures (Arrays, Linked List, Stack, Queue, Tree, Graph)
- Learn the basic algorithms (Sorting, Searching, Greedy, Dynamic Programming, Backtracking, DFS)
- Learn to analyze time and space complexity of algorithms.
- Learn to use Big O notation to describe time and space complexity.
- Practice implementing them in code.
- Learn to use recursion and memoization to solve problems.
- Learn to use divide and conquer to solve problems.
- Dynamic programming
- Basic bit manipulation
- Practice solving problems on platforms like LeetCode, HackerRank, CodeForces, etc.
Even if you get your solution correct, not being able to explain complexity and functionality of the code is a major red flag.
In live problem solving round, The problem statement will be intentionally vague, so you need to ask for clarification. Like the constraint limit or time limit or maybe what the output should be for some edge cases. Don't go with your assumption just because you seen this problem in past. This is the most common mistake I see in live problem solving round. Learn to communicate effectively and ask for clarification.
The problem with regular problem solvers' is we directly jump into problem solving without sharing our idea first. Some interviewer prefers you discuss the solution with them before start coding and some prefers you solve first then they'll ask. Ask them which will they prefer.