Code works fine on local eclipse. Returns Runtime Error on KickStart 
platform. Any idea?
Round B 2020 - 1st problem:

package p3;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Solution {

public static int checkPeakPoints(int n, int[] arr) {
int peak = 0;
for (int i = 1; i < arr.length - 1; i++) {
if (arr[i] > arr[i - 1] && arr[i] > arr[i + 1])
peak++;
}
return peak;
}

public static void main(String[] args) {
Scanner in = new Scanner(new BufferedReader(new 
InputStreamReader(System.in)));
int t = in.nextInt();
List<int[]> x = new ArrayList<int[]>();
for (int i = 1; i <= t; ++i) {
int n = in.nextInt(); // number of arr
int[] arr = new int[n];
for (int j = 1; j <= n; j++) {
int m = in.nextInt();
arr[j-1] = m;
}
x.add(arr);
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < x.size(); i++) {
int[] arr = x.get(i);
int sol = checkPeakPoints(arr.length, arr);
sb.append("Case #"+(i+1)+": "+sol+"\n");
}
System.out.println(sb.toString());
}
}




-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/48131e7f-8609-4c5e-8ac0-9fd0eab8e968%40googlegroups.com.

Reply via email to