🚀 LeetCode Top 150 — Progress Log #1
Source: Dev.to
Progress
I’ve officially started my Top 150 LeetCode journey to strengthen my foundations in Data Structures & Algorithms.
Progress: 3 / 150 problems solved.
Rather than rushing through problems, my focus is on understanding patterns, improving reasoning, and writing cleaner solutions over time.
Approach: Merge Sorted Array (Pointer‑based merging)
Key Learning: Use pointer‑based merging instead of relying purely on sorting.
class Solution {
public:
vector merge(vector& nums1, int m, vector& nums2, int n) {
// Copy nums2 into the tail of nums1
for (int i = m; i nums1[j + 1]) {
swap(nums1[j], nums1[j + 1]);
}
}
}
return nums1;
}
};
Approach: Write a pointer (idx) to overwrite unwanted values in‑place.
Approach: Remove Element
Key Learning: Overwrite elements that should be kept and return the new length.
class Solution {
public:
int removeElement(vector& nums, int val) {
int idx = 0;
for (int i = 0; i & nums) {
if (nums.empty()) return 0;
int idx = 1;
for (int i = 1; i < nums.size(); ++i) {
if (nums[i] != nums[i - 1]) {
nums[idx++] = nums[i];
}
}
return idx;
}
};
General Insights
Early DSA problems may look simple, but they help build essential habits:
- Thinking in‑place
- Minimizing extra memory
- Recognizing reusable patterns
This challenge isn’t about speed—it’s about consistent improvement.
Next Target
📍 Next Target: Continue progressing through the Top 150 problems.
If you’re also working on DSA or building consistency in problem solving, let’s grow together.
Connect
- GitHub: https://github.com/CodeWithDeeksh
- X (Twitter): https://x.com/deekshithax
One problem at a time. Consistency over intensity.