CODEFORCES 1145A

CODEFORCES 

1145A - THANOS SORT

Link to Ques - Codeforces 1145A
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.Scanner;

public class CF1145A {

    static int[] arr;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        arr = new int[in.nextInt()];
        for(int i = 0; i < arr.length; i++) {
            arr[i] = in.nextInt();
        }
        System.out.println(dp(0, arr.length));
    }

    static int dp(int l, int r) {
        for(int i = l+1; i < r; i++) {
            if(arr[i] < arr[i-1]) {
                int mid = (l+r)/2;
                return Math.max(dp(l, mid), dp(mid, r));
            }
        }
        return r-l;
    }
}

Comments

  1. Titanium Edc - Tile Art - TI-TITanium
    TIPTOBET. The TOTO-TITanium titanium gr 5 was a bronze resin resin resin titanium build for kodi resin resin titanium guitar chords resin resin titanium eyeglasses resin resin resin resin resin resin resin resin resin resin resin resin resin resin ford ecosport titanium resin resin resin resin resin

    ReplyDelete

Post a Comment

Popular posts from this blog

Class 12 Chemistry Practicals

Class 12 Physics Practicals