Saturday, September 14, 2013

Topcoder SRM 585 DIV 2 L1 LISNumberDivTwo

// Topcoder SRM 585 DIV 2 L1 LISNumberDivTwo

import java.util.*;
import java.math.*;

//rename the class name before submitting
public class LISNumberDivTwo {
public static void main(String[] args) {
LISNumberDivTwo obj = new LISNumberDivTwo();
System.out.println(
obj.calculate(
null
));
}

public int calculate(int[] seq) {
int cnt = 1;
for (int i = 1; i < seq.length; i++) {
if (seq[i] <= seq[i - 1])
cnt++;
}
return cnt;
}
}

No comments:

Post a Comment