
🚀 LeetCode Top 150 — Progress Log #1
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. 🧩 Problems Solved Today 1️⃣ Merge Sorted Array Approach: Merged elements from the second array into the first and applied sorting to maintain order. Key Learning: A working solution isn’t always the optimal one. This problem introduced the importance of thinking about pointer-based merging instead of relying purely on sorting. class Solution { public: vector < int > merge ( vector < int >& nums1 , int m , vector < int >& nums2 , int n ) { for ( int i = m ; i < m + n ; i ++ ) { nums1 [ i ] = nums2 [ i - m ]; } for ( int i = 0 ; i < m + n - 1 ; i ++ ) { for ( int j = 0 ; j < m + n - i - 1 ; j ++ ) { if ( nums1 [ j ] > nums1 [ j + 1 ]) { swap ( nums1 [ j ], nums1 [ j + 1 ]); } } } return nums1 ; } }; 2️⃣
Continue reading on Dev.to
Opens in a new tab



