Finding the second smallest integer in array

后端 未结 19 2249
無奈伤痛
無奈伤痛 2021-01-18 05:48

We are required in our assignment to find the second smallest integer in one array recursively. However, for the sake of understanding the subject more, I want to do it iter

19条回答
  •  庸人自扰
    2021-01-18 06:17

    Simply, you can do this

    int[] arr = new int[]{34, 45, 21, 12, 54, 67, 15};
    Arrays.sort(arr);
    System.out.println(arr[1]);
    

提交回复
热议问题