The shortest Java code,only one row with two "?:" replace "If"


  • -1
    L
    public static void merge(int A[], int m, int B[], int n) {
        while(n>0) {
        	A[m+n-1] = 0==m?B[--n]:A[m-1]>B[n-1]?A[--m]:B[--n];
        }
    }

Log in to reply
 

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