My issue
there is no such failed values to my code still it is not submitted, i tried to debug my code it shows sorry no such cases found it shows…and how on earth it is wrong when all outputs are correct
My code
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main(String[] args) throws java.lang.Exception
{
// your code goes here
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t--> 0) {
int n = in.nextInt();
int x = in.nextInt();
int hp[] = new int[n];
int max1[] = new int[n];
for (int i = 0; i < n; i++) {
hp[i] = in.nextInt();
}
Arrays.sort(hp);
for (int i = 0; i < n; i++) {
max1[i] = hp[i] + x * (n - 1 - i);
}
int o = Arrays.stream(max1).max().getAsInt();
System.out.println(o);
// int num=hp[0];
// if((hp[n-1])>=(x*(n-1)+ num)){
// System.out.println(hp[n-1]);
// }else
// System.out.println(x*(n-1)+ num);
}
in.close();
}
}
Problem Link: Monster Monster Practice Coding Problem