Merge Sorted Array in-place with O(m + n) Time Complexity

Day 18/100 – LeetCode Challenge 🚀 Problem: Merge Sorted Array Approach: Used three pointers starting from the end of the arrays Compared elements from nums1 and nums2 Placed the larger element at the last available position in nums1 Time Complexity: O(m + n) Space Complexity: O(1) (in-place) Key takeaway: When merging arrays in-place, working from the end avoids unnecessary shifting of elements. #LeetCode #100DaysOfCode #DSA #Java #ProblemSolving #InterviewPrep #100DaysOfLeetCode

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories