Cody

Solution 1531719

Submitted on 17 May 2018 by Srishti Saha
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))))

p = 0×0 empty char array s = '0001' p = '0' s = '0101' p = '01' s = '0111' p = '011' s = '0110' p = '0110' p = 0×0 empty char array s = '0001' p = '0' s = '0101' p = '01' s = '0111' p = '011' s = '0110' p = '0110'

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

p = 0×0 empty char array s = '01' p = '0' s = '00' p = '00' p = 0×0 empty char array s = '01' p = '0' s = '00' p = '00'

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

p = 0×0 empty char array s = '0' p = '0' p = 0×0 empty char array s = '0' p = '0'

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

p = 0×0 empty char array s = '000000001' p = '0' s = '010000001' p = '01' s = '011000001' p = '011' s = '011100001' p = '0111' s = '011110001' p = '01111' s = '011111001' p = '011111' s = '011111101' p = '0111111' s = '011111111' p = '01111111' s = '011111110' p = '011111110' p = 0×0 empty char array s = '000000001' p = '0' s = '010000001' p = '01' s = '011000001' p = '011' s = '011100001' p = '0111' s = '011110001' p = '01111' s = '011111001' p = '011111' s = '011111101' p = '0111111' s = '011111111' p = '01111111' s = '011111110' p = '011111110'

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

p = 0×0 empty char array s = '10001' p = '1' s = '11001' p = '11' s = '11101' p = '111' s = '11111' p = '1111' s = '11110' p = '11110' p = 0×0 empty char array s = '10001' p = '1' s = '11001' p = '11' s = '11101' p = '111' s = '11111' p = '1111' s = '11110' p = '11110'

Suggested Problems

More from this Author23