We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
we have almost same code here, but why my code didnt pass when it submitted. Do you kno why?
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int roll,n,k,x;
roll = scan.nextInt();
for (int i = 0; i < roll; i++) {
n = scan.nextInt();
k = scan.nextInt();
int countPos=0;
for (int j = 0; j < n; j++) {
x = scan.nextInt();
if (x<=0)
countPos++;
}
if (countPos>=k)
System.out.println("No");
else
System.out.println("Yes");
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Angry Professor
You are viewing a single comment's thread. Return to all comments →
we have almost same code here, but why my code didnt pass when it submitted. Do you kno why?
public static void main(String[] args) { Scanner scan = new Scanner(System.in); int roll,n,k,x;