about | help | code help+videos | done | prefs |
Write a method that accepts a string 'num' which represents a binary number. That string will ONLY contain 1's and 0's. Return how many 1's appear in the string. Please note that the string 'num' can be of any length. test2021_01_15_APP1SLHL_countBinaryOnes("10001000101") → 4 test2021_01_15_APP1SLHL_countBinaryOnes("1") → 1 test2021_01_15_APP1SLHL_countBinaryOnes("0") → 0 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 230
Copyright Nick Parlante 2017 - privacy