Connect with Peer Bloggers

Get your Bloggers ID and network with best bloggers around the world.

15

scores100 : Solutions for Javabat : 29

Hasi Wk
Hasi's Cyber Journal ― QuestionGiven an array of scores, return true if there are scores of 100 next to each other in the array. The array length will be at least 2. scores100({1, 100, 100}) → true scores100({1, 100, 99, 100}) → false scores100({100, 1, 100, 100}) → trueSolutionpublicboolean scores100(int[] scores) {boolean b=false;for(int i=0; i<scores.length;i++){if(scores[i]==100 && i+1<scores.length && scores[i+1]==100) { b=true;break; }else b=false; [...]

What would you say?

Be the first to comment on this blog post! Sign in or Create an account.