Binary Neighbourhood - MATLAB Cody - MATLAB Central

Problem 2735. Binary Neighbourhood

Difficulty:Rate

Given a natural number reorder its binary form to create another number, closest to the given one.

Examples:

  • 1 gives 2, ( 1(dec) > 1 > 01 > 10 > 2(dec) )
  • 2 gives 1, ( 2(dec) > 10 > 01 > 1(dec) )
  • 5 gives 6, ( 5(dec) > 101 > 110 > 6(dec) )

Solution Stats

47.51% Correct | 52.49% Incorrect
Last Solution submitted on Dec 30, 2024

Problem Comments

Solution Comments

Show comments

Group

Project Euler II Image
Project Euler II
  • 12 Problems
  • 51 Finishers

Problem Recent Solvers91

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page