id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > bbvdCountOnes
prev  |  next  |  chance

Write a method that returns the number of occurances of the number "1" in an array of integers. Only count the number 1, NOT the number of times the digit 1 occurs. For example, do NOT count 11 or 131 since they are not the number 1. We are only looking for the number 1, not the digit 1.


bbvdCountOnes([]) → 0
bbvdCountOnes([1, 2, 1, 4, 0]) → 2
bbvdCountOnes([0, 3, 3, 4, 5, 2]) → 0

...Save, Compile, Run (ctrl-enter)

public int bbvdCountOnes(int[] choices) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 280

Copyright Nick Parlante 2017 - privacy