Java: Merge Sorted Arrays

Level : Intermediate
Mentor: Amit Kumar Ghosh
Type : GuidedLab
Points : 10
Duration : 00:25:00

Lab Details

Difficulty Level: EASY

Problem Statement:

Given two sorted integer arrays `nums1` and `nums2`, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively.

Merge `nums2` into `nums1` as one sorted array.

Input:

nums1 = [1,2,3,0,0,0], m=3

nums2 = [2,5,6], n=3

Output:

[1,2,2,3,5,6] //Merge Array should be Sorted.

Self-paced Membership
  • 22+ Video Courses
  • 800+ Hands-On Labs
  • 400+ Quick Notes
  • 55+ Skill Tests
  • 45+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this