8.19 houzz phone interview



  • Q1) Given an integer array e.g. [1, 5, 2, 4, 3, 6], write a function to count the number of inversions in the array.

    Inversion -> a pair of indices (i,j) where i < j and A[i] > A[j].

    JS - var x = 8;
    x = 9;
    val x = 10;
    x = 7;
    */

    class Solution {
    // [1, 5, 2, 4, 3, 6]
    public static void main(String[] arr){
    int[] input = new int[]{1, 5, 2, 4, 3, 6};
    System.out.println(inversionCounts(input));
    }
    public static int inversionCounts(int[] input){

    }


登录后回复
 

与 BitTiger Community 的连接断开,我们正在尝试重连,请耐心等待