Complement of Base 10 Integer

Try to solve the Complement of Base 10 Integer problem.

Statement

For any nn positive number in base 10, return the complement of its binary representation as an integer in base 10.

Constraints

  • 0≤n≤1090 \leq n \leq 10^9

Examples

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy