LeetCode 30 Days Challenge

Mouad Abuaisha
4 min readMay 1, 2020

--

Throughout the lockdown of major sectors around the world, most people ended up with a good amount of free time daily. LeetCode though (The World’s Leading Online Programming Learning Platform), offered a 30 days challenge consisting of 30 different algorithms & data structure problems for you to practice those fundamentals daily.

I have been working as a web developer for almost a year and a half now, and I thought these problems will be a piece of cake for me. fortunately, I WAS WRONG.

LeetCode generally introduces different algorithms and data structures for each problem. While you go through each problem, you will definitely learn new techniques and programming concepts.

Here is a list of subjects that I learned more about during this month:

Linked Lists

linked list

This is not an entirely new concept for me but as C# programmer I tend to use Lists whenever I need a sequence. Thankfully, LeetCode taught me the importance of other generics such as linked lists. They are a time-space efficient structure that’s widely used in lots of algorithms and structures. For instance, you may build a structure that supports GetMin, GetMax and Remove functions in O(1) time. First Unique Number problem demonstrates those functions in a class.

Hash Sets

Another useful optimized structure. Previously, when I needed to store a sequence of integers I would jump to lists immediately. After a few trials on enhancing my code, I found the sets. It’s a magical collection that supports element insertion, removal, addition, containment in O(1) time and takes O(N) size of memory.

Hash Tables (Maps)

HashMap

This is a key-value pair set. just like the HashSet, it supports retrieving values paired with distinct keys in O(1) time. I found this structure useful when I tried to store frequencies of given sums in Subarray Sum Equals K problem. It’s a widely used structure, especially in dynamic programming.

Binary Trees

binary tree

This is a structure that I misunderstood for a long time. I was always afraid of digging deep into this structure because I hated the pointer-recursion behavior of it. Fortunately, LeetCode will force you to understand this structure whether you like it or not!

It’s a very useful structure, you can store paths and sequences in it and you can traverse through it from root to leaf or vice versa. you might also find yourself traversing from leaf to leaf through a middle node such as Binary Tree Maximum Path Sum & Diameter of Binary Tree solution require.

Dynamic Programming

dynamic programming

Breaking your problem to smaller parts and solve for each part individually until you sum up the whole solution is a brilliant approach. Maximal Square problem will require such behavior as you’ll be asked to calculate the maximum square space consists only 1’s in a binary matrix. In Addition, Longest Common Subsequence is a typical example of this approach.

Depth First Search

depth first search DFS

Usually, when you need to go through all the nodes of a binary tree to find some path or summation of nodes you’ll end up using DFS. It’s a useful algorithm that uses recursive behavior to traverse all the way from root to leaves and back. Binary Tree Maximum Path Sum & Diameter of Binary Tree are perfect examples demonstrating this algorithm.

Finally, If you’re a new programmer, or even if you’re an experienced one I highly recommend the May Upcoming Challenge for you to polish your skills and maybe learning new things as well.

--

--

Mouad Abuaisha
0 Followers

A Jr Software developer @LTT, Interested in data structures, design patterns and how to make a developer life easier.