This is a repository for the solutions of various Leetcode problems. It was started with the aim of making a nice database of various leetcode problems in C++.
Happy Leetcoding!
How do I determine if today was productive or not ?
I have some clear objectives which I would love to achieve on a daily basis
- Workout for 45 minutes
- Clean eating throughout the day
- Reading Book for 20 mins
- Accomplish daily goals in work (I set them a night before)
- Meditate in morning for 15 mins
- Sleep for 7-8 hours
but the sad part is I am not Superman, so to call my day a productive I try to accomplish minimum 4 out of 6 things mentioned above.
Then, every week I try to beat my number of productive days.
I failed so many coding interviews until I learned these 30 lessons:
- Most interviewers are supportive and want you to succeed.
- Prepare a short and concise introduction.
- Be ready to discuss technical aspects of your projects in detail.
- Understanding the problem well is the first step during interviews.
- Never assume things which are not given in the problem.
- Ask clarifying questions about the problem, input/output format, constraints, and edge cases.
- It’s ok to use pen and paper and take notes during the interview.
- Pick a programming language you are most comfortable with.
- Start Simple, Then Optimize.
- You are not expected to know the perfect solution immediately.
- Ask for hints if stuck for long.
- Listen attentively to the interviewer, and integrate the hints/suggestions.
- Start coding only when you're clear on what to write.
- Don't just code, communicate.
- Discuss your approach before you begin coding, not after.
- Think aloud. Your interviewer can't read your mind.
- Your solution is as good as how well you communicate it.
- Use meaningful variable names and keep your code organized.
- Break down complex questions into small independent questions.
- Prioritize optimizing computations that are repeated, overlapping, or redundant.
- Write clean, readable and modular code.
- Avoid overcomplicating your solution.
- Write tests to validate your solution. Consider edge cases.
- Be ready to discuss the time and space complexity of your code.
- Behavioral questions are important too.
- Have few questions to ask the interviewer.
- Rest well before the Interview.
- Start giving interviews before you think you are ready.
- Luck plays a significant role, so don't be disappointed if you aren't selected.
- Use rejections as opportunities to identify areas for improvement.
Bonus: HashMaps are your best friend. Know them well.
This repository contains LeetCode resources which are useful during interview preparation.
- 14 Coding Interview Patterns
- Sliding Window patterns
- Two Pointers Patterns
- Substring Problem Patterns
- Dynamic Programming Patterns
- Binary Search Patterns
- Backtracking Patterns
- Tree Patterns
- Graph Patterns
- Monotonic Stack Patterns
- Bit Manipulation Patterns
- String Question Patterns
- DFS + BFS Patterns (1)
- DFS + BFS Patterns (2)
- Stock Series Patterns
- LeetCode Timer: Easily time your leetcode practise sessions with automatic time setting based on difficulty.
- LeetCode Video Solutions: Watch free LeetCode video ▶ solutions on the problem page itself.
- LeetCode Format: Adds Format code button on leetcode to format the code using Prettier code formatter.
- LeetHub v2: Automatically integrate your Leetcode & GeeksforGeeks submissions to GitHub.
- LeetCode VS Code Extension: Solve LeetCode problems in VS Code.
Your contributions are most welcome!
Solve Leetcode problems and add the solutions here. Follow the naming pattern for ease in locating the solutions. Some sample issues have been created for your convenience but feel free to add more issues and send PRs. Remember not to duplicate questions and not to submit problems during any ongoing competition.