How to Improve Logic Building Skills in Programming

ยท

4 min read

How to Improve Logic Building Skills in Programming

Have you ever experienced the incapability to solve a problem in programming, even after practising a lot?

Then these 6 tips will help you to overcome this problem. It has helped me too, and I hope it will be of any use to you.

Concepts Are More Important Than Contests

Many times, I have seen school and college students participate in coding contests (like leetcode weekly contests) without completely learning the important concepts first. At most times, they fail and procrastinate. They think that programming is not for them and lose their interest. This have a bad impact on their career. I would recommend them to first understand the concepts, then practice and then participate in contests.

Thinking in the first place, then coding

Programmers do coding, but after thinking. At first, one should analyse the question very carefully. Try to use pen and paper to draw diagrams(such as for linked list, recursion and pattern questions) and sketching how the code will work. Find edge cases or corner cases and try to take actions accordingly. Use at least 2 sample inputs to check if the program works completely fine or not through the dry run process (execute the code manually by going through each line). Now, you might get stuck in an error, try to resolve that problem using search engines like google. Now you are all set to launch your IDE and start coding your program.

Step-By-Step Approach

What many computer science students make mistake is that they try to get the most optimised solution at their very first try --- but that's not the right approach. Always remember ~

"Rome was not built in a day".

So, at first try to solve the problem using the Brute force approach (Creating the program without considering time and space complexities). Then, try to reduce the time complexity (like binary search in place of linear search for any sorted array) and next, move forward to reduce the space complexity (use maps and sets).

Practice is the key

Due to the burden of other subjects in school level, many school students fail to practise in the right way. Be consistent while learning to code. Don't skip more than 3 days between any two coding sessions and give at least an hour towards programming. Try to solve problems on the concepts you have previously learned, thus revising those concepts once again.

Move on

Often beginners and mid-experienced in programming field stuck at problems. They should spend time on that but in a proper way. For an easy question, not more than 5 - 10 minutes should be spent and for a medium level question, not more than 15 - 20 minutes. For a hard level question, you should not spend more than 40 - 60 minutes. Initially, you will not be able to maintain the time limit, but with practise the time limit can be maintained well enough. So, if the time limit exceeds twice the original time (suppose you are taking more than 20 minutes, or 40 minutes or 2 hour for easy, medium and hard level questions), then go through the solution. There might be a special hint which is required to solve some problems (not in most cases). Note down the optimisations (if any) and the hint in a paper, and try to revisit the problem later (2-4 weeks later) to check if you can solve it or not.

Solve Puzzles

This is a great way to relax and increase concentration simultaneously when you procrastinate and is frustrated. It allows only the logical part of your brain to be at work and the rest part of the brain relax. Moreover, you can play sudokus and chess which improves memory and thinking skills, which in turn helps in logic building.

So, these were the 6 tips that I think can help you to increase your logic building skills in programming. I would recommend a course on DSA (Data Structures And Algorithms) taught by Kunal Kushwaha. You can go for that course, it's free and very nice. Here is the link -> Java + DSA + Interview Preparation Course

If anything is missed out, then you can comment below. It would be warmly welcomed.

Connect With me ๐Ÿ’ฌ Here

Thank you !

ย