Skip to content

Commit

Permalink
feat: 인프런 알고리즘 문제 풀이
Browse files Browse the repository at this point in the history
feat: 인프런 알고리즘 문제 풀이
  • Loading branch information
dlwnsgus777 committed May 19, 2023
1 parent 447e83a commit 2b99122
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions practice/src/main/java/inflean/chapter2/보이는학생.java
@@ -0,0 +1,26 @@
package inflean.chapter2;

import java.util.Scanner;

public class 보이는학생 {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = in.nextInt();
}

int result = 1;
int taller = arr[0];
for (int i = 1; i < n; i++) {
if (arr[i] > taller) {
taller = arr[i];
result++;
}
}

System.out.println(result);
return ;
}
}

0 comments on commit 2b99122

Please sign in to comment.