Taking test case loop and again ur print the output in another loop

Thank You
Chitaranjan Pradhan

On Mon, 20 Apr, 2020, 10:09 PM vishakha narang, <visheshenar...@gmail.com>
wrote:

> *package* bike_tour;
>
>
> *import* java.util.Scanner;
>
> *import* java.io.*;
>
>
> *public* *class* Solution {
>
>
> *public* *static* *void* main(String[] args) {
>
> Scanner in = *new* Scanner(*new* BufferedReader(*new*
> InputStreamReader(System.*in*)));
>
> *if*(in.hasNext())
>
> {
>
> *int* t = in.nextInt();
>
> *int* peaks[] = *new* *int*[t];
>
> *for*(*int* i = 0;i<t;i++)
>
> {
>
> *int* n = in.nextInt();
>
> *int* arr[] = *new* *int*[n];
>
>
> *for*(*int* j = 0;j<n;j++)
>
> {
>
> arr[j] = in.nextInt();
>
>
> }
>
> *for*(*int* j = 1;j<(n-1);j++)
>
> {
>
> *if*(arr[(j-1)]<arr[j]&&arr[j]>arr[(j+1)])
>
> {
>
> peaks[i]++;
>
> }
>
> }
>
> }
>
> *for*(*int* j = 0;j<t;j++)
>
> {
>
> System.*out*.println("Case #"+(j+1)+": "+peaks[j]);
>
> }
>
> }
>
> }
>
>
> }
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/7e7d9e8b-68d3-4a71-aedf-747ac3ac3c33%40googlegroups.com
> <https://groups.google.com/d/msgid/google-code/7e7d9e8b-68d3-4a71-aedf-747ac3ac3c33%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAAGy8Wu-z2FWEWssbmyOmQ0NPu66b0JxMvUZy%2BrPWHaiZzHJ9A%40mail.gmail.com.

Reply via email to