Introduction
I came across Leetcode in 2022.It seemed really difficult at first and I was unsure about how to approach it. I decided to go into it after a brief stint working as a contractor at Indeed. I started working on the problems in 2023 after trying coding challenges at codewars and codesignal. I completed 258 problems in my first year and decided to try complete 1000 problems in 2024.Here was my approach.
Approach
Every day, I read the problem, looked at the topic and tried coming up with an algorithm written in Java that solved the problem. Often, this led to a Time Limit Exceeded or Memory limit exceeded or there were test cases that didnt work and I had to spend time tweaking my algorithm to work.Sometimes,this took hours and I may have had to take a short break when an idea came to me.Later on in the year,I also started solving in C# and Javascript.I also started reading the discussions and hints to solve the problems.
Lessons Learned
1)Brute force is the most inefficient way to solve a problem and should only be used when the constraints are small.
2)Read the problems thoroughly and try to understand it. If you misunderstand anything, it can affect your algorithm negatively.
3)Trying to solve the problem on your own will help you increase your skill and learn. However, there is no need to reinvent the wheel. When stuck, please consult the discussions and the hints. This approach can be applied at work to make things more efficiently.
4)Learning is always ongoing. Even after solving 1200 problems, there are still Leetcode problems that are difficult for me.
5)Solving problems in different languages exposes you to different ways of thinking.
6)Fears can be conquered by taking action.
Way Forward
This year I am going to focus more on tackling hard problems,writing algorithms in different programming languages and on mastering some data structures and algorithms.
If you have any comments,dm me or comment on this post.
Way
Top comments (0)