Cody

Problem 45663. Find the next binary palindrome number

Solution 3083966

Submitted on 6 Oct 2020 by JB
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = 241; y_correct = 255; assert(isequal(NextBinaryPalindrome(x),y_correct))

y = 255

2   Pass
x = 2020; y_correct = 2047; assert(isequal(NextBinaryPalindrome(x),y_correct))

y = 2047

3   Pass
x = 10051; y_correct =10233; assert(isequal(NextBinaryPalindrome(x),y_correct))

y = 10233

4   Pass
x =40504; y_correct =40569; assert(isequal(NextBinaryPalindrome(x),y_correct))

y = 40569