Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 431 Bytes

mergeTowArray.md

File metadata and controls

23 lines (15 loc) · 431 Bytes

Merge Two Sorted Arrays

This Java program merges two sorted arrays into a single sorted array.

How It Works:

  • Takes two sorted arrays (nums1 and nums2).
  • Merges them while maintaining sorted order.
  • Stores the result in nums1.

Usage:

Run the program in Java:

javac mergeTowArray.java
java mergeTowArray


nums1 = {-5, -2, 4, 5, 0, 0, 0};
nums2 = {-3, 1, 8};


nums1[] = -5 -3 -2 1 4 5 8

Author: Sakshi