Simple Java Solution (Using API Sort)


  • 0
    G

    I know that this is not a acceptable solution, but it solve the problem .

    public class Solution {
        public void merge(int[] nums1, int m, int[] nums2, int n) {
            for(int i = 0; i < n; i++) {
                nums1[m] = nums2[i];
                m++;
            }
            Arrays.sort(nums1);
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.