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.
You can get rid of the unneccessary variable 't' by just using a scan.hasNextInt():
publicstaticvoidmain(String[]args){Scannerin=newScanner(System.in);in.nextLine();// skip num testcaseswhile(in.hasNextInt()){intn=in.nextInt();intk=in.nextInt();into=0;for(inti=0;i<n;i++)if(in.nextInt()<=0)o++;System.out.println(o>=k?"NO":"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 →
Nice and readable.
You can get rid of the unneccessary variable 't' by just using a scan.hasNextInt():