7 kyu

Ones' Complement

1,133 of 2,571marbiru

Description:

The Ones' Complement of a binary number is the number obtained by swapping all the 0s for 1s and all the 1s for 0s.

For any given binary number,formatted as a string, return the Ones' Complement of that number.

Examples

"0"    -> "1"
"1"    -> "0"
"000"  -> "111"
"1001" -> "0110"
"1001" -> "0110"
Fundamentals

Similar Kata:

More By Author:

Check out these other kata created by marbiru

Stats:

CreatedSep 7, 2017
PublishedSep 7, 2017
Warriors Trained3138
Total Skips16
Total Code Submissions4423
Total Times Completed2571
JavaScript Completions1133
C# Completions320
Python Completions1049
Ruby Completions87
C Completions87
COBOL Completions11
Total Stars21
% of votes with a positive feedback rating93% of 506
Total "Very Satisfied" Votes440
Total "Somewhat Satisfied" Votes59
Total "Not Satisfied" Votes7
Total Rank Assessments15
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • marbiru Avatar
  • Voile Avatar
  • Souzooka Avatar
  • hobovsky Avatar
  • trashy_incel Avatar
  • user8436785 Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • dfhwze Avatar
  • saudiGuy Avatar
Ad