public class Practice2 {
public static int solution(int[] arr) {
int[] dp = new int[arr.length + 1];
int result = 0;
for(int i = 1; i <= dp.length-1; i++){
dp[i] = 1; // 기본 비교횟수는 항상 1
for(int j = 1; j<i; j++){
if (arr[j-1] < arr[i-1]){// j부터 i까지 계속 증가하고 있는지 조사를 함
dp[i] = Math.max(dp[i], dp[j]+1);// 비교하면서 채워줌
}
}
result = Math.max(result, dp[i]);
}
return result;
}
public static void main(String[] args) {
// Test code
int[] arr = new int[]{10, 20, 30, 10, 50, 10};
System.out.println(solution(arr));
}
}