Problem solving is mostly language-independent, so whatever you practice in C++ carries over. What worked for me:
Before writing any code, solve a small example by hand on paper and write down the steps you took. That list is your algorithm; the code is just a translation of it.
Do lots of easy problems instead of a few hard ones: Codeforces Div. 3/4 A–B, LeetCode Easy, or the intro section of the CSES problem set.
If you're stuck for 30–45 minutes, read the editorial or solution. Then close it and reimplement it from scratch the next day. That's where most of the learning happens.
Learn the standard patterns one at a time: two pointers, prefix sums, sorting + greedy, binary search on the answer, BFS/DFS, and simple DP. Most beginner problems are one of these.
Get comfortable with the STL (vector, string, unordered_map, set, priority_queue, sort, lower_bound) so the language stops getting in your way.
Keep a short file of your recurring mistakes: off-by-one errors, int overflow (use long long), and forgetting to reset state between test cases. You'll keep running into the same ones.
Consistency beats intensity. One or two problems a day for a few months makes a big difference.
1
u/Dapper-Situation-864 4d ago
Problem solving is mostly language-independent, so whatever you practice in C++ carries over. What worked for me:
Before writing any code, solve a small example by hand on paper and write down the steps you took. That list is your algorithm; the code is just a translation of it.
Do lots of easy problems instead of a few hard ones: Codeforces Div. 3/4 A–B, LeetCode Easy, or the intro section of the CSES problem set.
If you're stuck for 30–45 minutes, read the editorial or solution. Then close it and reimplement it from scratch the next day. That's where most of the learning happens.
Learn the standard patterns one at a time: two pointers, prefix sums, sorting + greedy, binary search on the answer, BFS/DFS, and simple DP. Most beginner problems are one of these.
Get comfortable with the STL (vector, string, unordered_map, set, priority_queue, sort, lower_bound) so the language stops getting in your way.
Keep a short file of your recurring mistakes: off-by-one errors, int overflow (use long long), and forgetting to reset state between test cases. You'll keep running into the same ones.
Consistency beats intensity. One or two problems a day for a few months makes a big difference.