Cody

Problem 45663. Find the next binary palindrome number

Solution 2407007

Submitted on 28 May 2020 by Syd Shahed
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))

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

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

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