Cody

# Problem 2202. Flip the bit

Solution 407738

Submitted on 21 Feb 2014 by Abdullah Caliskan
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
%% s = '1001'; y_correct = '0110'; assert(all(isequal(flipbit(s),y_correct)&ischar(flipbit(s))))

k = 0 1 1 0 p = 0 1 1 0 i = ' ' ' ' ' ' ' ' ' ' ' ' j = 2 3 5 6 8 9 k = 0 1 1 0 p = 0 1 1 0 i = ' ' ' ' ' ' ' ' ' ' ' ' j = 2 3 5 6 8 9

2   Pass
%% s = '11'; y_correct = '00'; assert(all(isequal(flipbit(s),y_correct)&ischar(flipbit(s))))

k = 0 0 p = 0 0 i = ' ' ' ' j = 2 3 k = 0 0 p = 0 0 i = ' ' ' ' j = 2 3

3   Pass
%% s = '1'; y_correct = '0'; assert(all(isequal(flipbit(s),y_correct)&ischar(flipbit(s))))

k = 0 p = 0 i = {} j = [] k = 0 p = 0 i = {} j = []

4   Pass
%% s = '100000001'; y_correct = '011111110'; assert(all(isequal(flipbit(s),y_correct)&ischar(flipbit(s))))

k = 0 1 1 1 1 1 1 1 0 p = 0 1 1 1 1 1 1 1 0 i = Columns 1 through 14 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' Columns 15 through 16 ' ' ' ' j = 2 3 5 6 8 9 11 12 14 15 17 18 20 21 23 24 k = 0 1 1 1 1 1 1 1 0 p = 0 1 1 1 1 1 1 1 0 i = Columns 1 through 14 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' Columns 15 through 16 ' ' ' ' j = 2 3 5 6 8 9 11 12 14 15 17 18 20 21 23 24

5   Pass
%% s = '00001'; y_correct = '11110'; assert(all(isequal(flipbit(s),y_correct)&ischar(flipbit(s))))

k = 1 1 1 1 0 p = 1 1 1 1 0 i = ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' j = 2 3 5 6 8 9 11 12 k = 1 1 1 1 0 p = 1 1 1 1 0 i = ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' j = 2 3 5 6 8 9 11 12

### Community Treasure Hunt

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

Start Hunting!