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

 

simona1@sfusd.edu recursivepaperfolding > onesComplement
prev  |  next  |  chance

Returns the one's complement of the String argument. The one's complement of a binary number is obtained by inverting all the bits, swapping 0s for 1s and vice versa. The argument will only contain 1s and 0s. (Note that your solution need not be recursive, it will be used as a helper function in the next problem)


onesComplement("1") → "0"
onesComplement("0") → "1"
onesComplement("101") → "010"

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

public String onesComplement(String s){ }

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

Copyright Nick Parlante 2017 - privacy