Drive Code
public static void main ( String [ ] args ) { int arr [ ] = { 1 , 3 , 4 , 1 , 5 , 1 , 5 , 3 } ; int N = arr . length ; int K = 4 ; System . out . print ( maxCostToRemove ( arr , N , K ) ) ; } }