This September, I embarked on a self-imposed 30 Days of Code challenge, a commitment to solve at least two Data Structures and Algorithms (DSA) problems every single day. My goal was to push myself out of my comfort zone, build consistency, and improve my problem-solving skills and programming logic.
I didn’t just stick to one platform — I completed HackerRank’s 30 Days of Code challenge, LeetCode’s 30 Days of JavaScript plan, and also tackled LeetCode’s Top Interview 150 track, a collection of 150 typical interview problems for anyone prepping for a coding interview. Additionally, I took a few lessons on Structy to further strengthen my grasp of DSA concepts.
I solved most problems using JavaScript (except for a few HackerRank problems where JavaScript wasn’t supported, so I used Python instead). To help keep myself accountable, as well as share my progress, I posted the challenges I solved each day on Twitter. You can find them in this quote trail:
Each day exposed me to different types of data structures and algorithms. I learned to handle
Some problems involved more complex structures like linked lists and binary trees, while others threw matrices / n-D arrays into the mix, letting me deal in multidimensional spaces.
The diversity of the problems kept me on my toes. The problems on LeetCode’s 30 Days of JavaScript track introduced me to fundamentals like
LeetCode’s Top Interview 150 track took things a step further, tossing me between problems of varying difficulty and approach. Solving at least one of these each day was invaluable. These problems also challenged me to think more often about optimization and how different approaches could drastically affect runtime and memory efficiency.
I also took Structy lessons alongside these challenges to solidify my understanding of key concepts. I learned more efficient ways to handle some data structures, like the sections on linked lists and binary trees. I came to especially appreciate the platform’s dynamic approach to teaching and breaking down problems in a way that makes them easy to digest. It’s a great platform to learn DSA at a very basic level and then translate this understanding to other coding problems I face.
As the days progressed, I encountered many kinds of solution approaches, problem-solving techniques such as
I found the two-pointer approach a straightforward yet powerful way to work through problems involving sequences (primarily arrays and strings), by reducing the search space for more efficient solutions. I also used greedy algorithms where I needed to make locally optimal choices at each step.
Sliding window techniques were another eye-opener— initially challenging, but valuable for problems involving subarrays or substrings; problems that required keeping track of a moving range of elements within a sequence. Hashmaps and hashtables are great for key-value pairs in problems involving frequent lookups.
One of the most complex techniques I worked with was dynamic programming. Early on, I found DP quite intimidating due to the difficulty in recognizing overlapping subproblems, but with repeated exposure memoization became my best friend in optimizing recursive calls.
In addition to core DSA problems, I also got the chance to try out more advanced JavaScript concepts. I wrote wrapper functions, learning how to control the flow of my code and extend functionality for specific requirements. I even learned to set timers on functions which allows me handle time-sensitive operations or limit how often certain functions can execute.
Working with prototypes showed me that data types can be manipulated beyond their inbuilt capabilities by creating custom methods. This allowed me to extend the inbuilt functionality of data types like objects and arrays in new ways. I came to appreciate the importance of writing clean, modular code.<script> // Detect dark theme var iframe = document.getElementById('tweet-1840720685099864068-290'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1840720685099864068&theme=dark" } </script>
我还学习了记忆化,这是一种修改函数以存储先前调用的参数及其结果的技术!这是一种缓存,有助于提高多次调用同一函数的问题的性能。我在这里写了关于我的 Memoize 解决方案击败 99%(内存)的文章:Memoize 直观解决方案击败 99% 内存。
在这段旅程中我开始更加关注的另一件事是我的代码的优化。在正确介绍了 Structy 上的大 O 表示法之后,我理解了时间和空间复杂性的重要性,并且学会了解决最常见问题的最佳技术。在 HackerRank 挑战赛接近尾声时,我还学会了使用类测试代码并编写泛型。
当我完成 30 天编程挑战时,我感受到了深刻的成长感。它提高了我处理各种问题的能力,加深了我对 JavaScript 和 DSA 的理解。这一个月的旅程不仅仅是解决问题,还提醒自己,我真的可以付出努力。看到一致性和纪律的回报,我的心态得到了更新,可以充满信心和强大的技术工具包来应对任何挑战。
这次经历标志着我编程之旅的一个重要里程碑。我在这 30 天里磨练的技能无疑将延续到我作为软件工程师的职业生涯中。
我为自己付出的努力感到自豪,也感谢在整个挑战过程中为我加油、提供支持和智慧的朋友们。
以上是#aysofCode 九月:我的 DSA 掌握之旅的详细内容。更多信息请关注PHP中文网其他相关文章!