1 line and 0 ms Java Solution


  • 0
    T
    class Solution {
        public void merge(int[] nums1, int m, int[] nums2, int n) {
            int p=m+n-1; m--; n--; while(p>=0 && n>=0) nums1[p--]=(m>=0 && nums1[m]>nums2[n])?nums1[m--]:nums2[n--];
        }
    }
    

Log in to reply
 

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