#aysofCode 九月:我的 DSA 掌握之旅
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: <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>
Data Types, Basic to Advanced
Each day exposed me to different types of data structures and algorithms. I learned to handle
- arrays
- strings
- objects
- maps
- sets
- numbers
- booleans, and more.
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
- array transformations
- function transformations
- closures
- classes
- JSONs
- Promises & time.
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.
Approaches and Techniques
As the days progressed, I encountered many kinds of solution approaches, problem-solving techniques such as
- recursion
- two-pointer
- hashmap
- hashtable
- greedy algorithms
- binary search
- sliding window
- dynamic programming
- caching (memoization), and more.
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.
Function Manipulation (feat. Wrappers & Prototypes)
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.
我还学习了记忆化,这是一种修改函数以存储先前调用的参数及其结果的技术!这是一种缓存,有助于提高多次调用同一函数的问题的性能。我在这里写了关于我的 Memoize 解决方案击败 99%(内存)的文章:Memoize 直观解决方案击败 99% 内存。
测试与优化
在这段旅程中我开始更加关注的另一件事是我的代码的优化。在正确介绍了 Structy 上的大 O 表示法之后,我理解了时间和空间复杂性的重要性,并且学会了解决最常见问题的最佳技术。在 HackerRank 挑战赛接近尾声时,我还学会了使用类测试代码并编写泛型。
外卖
当我完成 30 天编程挑战时,我感受到了深刻的成长感。它提高了我处理各种问题的能力,加深了我对 JavaScript 和 DSA 的理解。这一个月的旅程不仅仅是解决问题,还提醒自己,我真的可以付出努力。看到一致性和纪律的回报,我的心态得到了更新,可以充满信心和强大的技术工具包来应对任何挑战。
这次经历标志着我编程之旅的一个重要里程碑。我在这 30 天里磨练的技能无疑将延续到我作为软件工程师的职业生涯中。
我为自己付出的努力感到自豪,也感谢在整个挑战过程中为我加油、提供支持和智慧的朋友们。
以上是#aysofCode 九月:我的 DSA 掌握之旅的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

不同JavaScript引擎在解析和執行JavaScript代碼時,效果會有所不同,因為每個引擎的實現原理和優化策略各有差異。 1.詞法分析:將源碼轉換為詞法單元。 2.語法分析:生成抽象語法樹。 3.優化和編譯:通過JIT編譯器生成機器碼。 4.執行:運行機器碼。 V8引擎通過即時編譯和隱藏類優化,SpiderMonkey使用類型推斷系統,導致在相同代碼上的性能表現不同。

Python更適合初學者,學習曲線平緩,語法簡潔;JavaScript適合前端開發,學習曲線較陡,語法靈活。 1.Python語法直觀,適用於數據科學和後端開發。 2.JavaScript靈活,廣泛用於前端和服務器端編程。

JavaScript是現代Web開發的核心語言,因其多樣性和靈活性而廣泛應用。 1)前端開發:通過DOM操作和現代框架(如React、Vue.js、Angular)構建動態網頁和單頁面應用。 2)服務器端開發:Node.js利用非阻塞I/O模型處理高並發和實時應用。 3)移動和桌面應用開發:通過ReactNative和Electron實現跨平台開發,提高開發效率。

本文展示了與許可證確保的後端的前端集成,並使用Next.js構建功能性Edtech SaaS應用程序。 前端獲取用戶權限以控制UI的可見性並確保API要求遵守角色庫

我使用您的日常技術工具構建了功能性的多租戶SaaS應用程序(一個Edtech應用程序),您可以做同樣的事情。 首先,什麼是多租戶SaaS應用程序? 多租戶SaaS應用程序可讓您從唱歌中為多個客戶提供服務

從C/C 轉向JavaScript需要適應動態類型、垃圾回收和異步編程等特點。 1)C/C 是靜態類型語言,需手動管理內存,而JavaScript是動態類型,垃圾回收自動處理。 2)C/C 需編譯成機器碼,JavaScript則為解釋型語言。 3)JavaScript引入閉包、原型鍊和Promise等概念,增強了靈活性和異步編程能力。

JavaScript在Web開發中的主要用途包括客戶端交互、表單驗證和異步通信。 1)通過DOM操作實現動態內容更新和用戶交互;2)在用戶提交數據前進行客戶端驗證,提高用戶體驗;3)通過AJAX技術實現與服務器的無刷新通信。

JavaScript在現實世界中的應用包括前端和後端開發。 1)通過構建TODO列表應用展示前端應用,涉及DOM操作和事件處理。 2)通過Node.js和Express構建RESTfulAPI展示後端應用。
