Cody

Solution 1579948

Submitted on 10 Jul 2018
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   Fail
N = 1; num_ones = 1; assert(isequal(popcount(N),num_ones))

Output argument "population" (and maybe others) not assigned during call to "popcount". Error in Test1 (line 3) assert(isequal(popcount(N),num_ones))

2   Fail
N = 2; num_ones = 1; assert(isequal(popcount(N),num_ones))

Output argument "population" (and maybe others) not assigned during call to "popcount". Error in Test2 (line 3) assert(isequal(popcount(N),num_ones))

3   Fail
N = 3; num_ones = 2; assert(isequal(popcount(N),num_ones))

Output argument "population" (and maybe others) not assigned during call to "popcount". Error in Test3 (line 3) assert(isequal(popcount(N),num_ones))

4   Fail
for num_ones = 3:10 N = 2^num_ones-1; assert(isequal(popcount(N),num_ones)) end

Output argument "population" (and maybe others) not assigned during call to "popcount". Error in Test4 (line 3) assert(isequal(popcount(N),num_ones))

5   Fail
for num_ones = 1:50 N = sum(2.^(find(randperm(50)<=num_ones)-1)); assert(isequal(popcount(N),num_ones)) end

Output argument "population" (and maybe others) not assigned during call to "popcount". Error in Test5 (line 3) assert(isequal(popcount(N),num_ones))

6   Fail
N = 23; num_ones = 4; assert(isequal(popcount(N),num_ones))

Output argument "population" (and maybe others) not assigned during call to "popcount". Error in Test6 (line 3) assert(isequal(popcount(N),num_ones))

7   Fail
N = 123; num_ones = 6; assert(isequal(popcount(N),num_ones))

Output argument "population" (and maybe others) not assigned during call to "popcount". Error in Test7 (line 3) assert(isequal(popcount(N),num_ones))

8   Fail
N = 123456; num_ones = 6; assert(isequal(popcount(N),num_ones))

Output argument "population" (and maybe others) not assigned during call to "popcount". Error in Test8 (line 3) assert(isequal(popcount(N),num_ones))

9   Fail
N = 1234567; num_ones = 11; assert(isequal(popcount(N),num_ones))

Output argument "population" (and maybe others) not assigned during call to "popcount". Error in Test9 (line 3) assert(isequal(popcount(N),num_ones))

10   Fail
N = 1125899906842501; num_ones = 45; assert(isequal(popcount(N),num_ones))

Output argument "population" (and maybe others) not assigned during call to "popcount". Error in Test10 (line 3) assert(isequal(popcount(N),num_ones))

Suggested Problems

More from this Author41