Write n as a 32-bit binary number. You may flip at most one 0 bit to 1. Return the length of the longest run of consecutive 1s you can get. For n = 1775 (11011101111) the answer is 8.
Example 1
Input:
longest_ones_after_flip(1775)
Output:
8
Example 2
Input:
longest_ones_after_flip(7)
Output:
4
0 <= n < 2**32No results yet
Run your code to check it against the examples, or submit to run every test.