Skip to main content

Posts

Showing posts with the label Day 20: Sorting Hackerrank Solution in Java

Day 20: Sorting Hackerrank Solution Java

 Day 20: Sorting Hackerrank Solution Java For Explanation Watch Video: Sample Input 0 3 1 2 3 Sample Output 0 Array is sorted in 0 swaps. First Element: 1 Last Element: 3 Code: import  java.io.*; import  java.util.*; import  java.text.*; import  java.math.*; import  java.util.regex.*; public   class  Solution {      public   static   void  main(String[] args) {         Scanner in =  new  Scanner(System.in);          int  n = in.nextInt();          int [] a =  new   int [n];          for ( int  a_i= 0 ; a_i < n; a_i++){             a[a_i] = in.nextInt();      ...