I am using Bottom up approach for solving this DP question (RPLB - Blueberries)
I am getting wrong answer in it. Can you tell me which test case I am missing.
`
public static void main(String[] args) throws IOException {
// write your code here
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int c = Integer.parseInt(br.readLine().trim());
int p = 1;
while(c-->0) {
String s[] = br.readLine().split(" ");
int n = Integer.parseInt(s[0]);
int k = Integer.parseInt(s[1]);
String s1[] = br.readLine().split(" ");
int arr[] = new int[n];
int dp[] = new int[n + 1];
int i = 0;
for (String str : s1) {
arr[i] = Integer.parseInt(str);
i++;
}
int sum=0;
if(n>1) {
if (arr[0] <= 100)
dp[0] = arr[0];
if (arr[1] <= 100)
dp[1] = Math.max(dp[0], arr[1]);
}
else{
if (arr[0] <= 100)
dp[0] = arr[0];
}
for (i = 2; i < n; i++) {
for(int j=0;j<i-1;j++){
sum = dp[j]+arr[i];
if(sum<=k)
dp[i] = Math.max(Math.max(dp[i - 1], sum), arr[i]);
else{
dp[i] = Math.max(dp[i], arr[i]);
}
}
}
for(i=n-1;i>=0;i--) {
if(dp[i]>0) {
System.out.println("Scenario #"+p+": "+dp[i]);
break;
}
}
p++;
}
}