You are viewing a single comment's thread. Return to all comments →
i dont think array is required , u can space optimize it i feel , check this out passes all the test case
public class Solution {
public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); int k=sc.nextInt(); int count=0; for(int j=0;j<n;j++) { int temp=sc.nextInt(); if(temp<=0) count++; } if(count>=k) System.out.println("NO"); else System.out.println("YES"); } }
}
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 →
i dont think array is required , u can space optimize it i feel , check this out passes all the test case
public class Solution {
}