Cody

Solution 1597181

Submitted on 1 Aug 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
vector1 = [0 0 0 0 0 0 0 0 0 0]; vector1_correct = [2 4 8 16 32 64 128 256 512 1024]; code = textread('PowersOf.m', '%s'); assert(isequal(PowersOf(vector1), vector1_correct) && ... strcmp(code(5), 'for') && ... strcmp(code(end-7), 'end') && ... strcmp(code(end-6), 'end'));

vector = [] append = 2 vector = 2 append = 4 vector = 2 4 append = 8 vector = 2 4 8 append = 16 vector = 2 4 8 16 append = 32 vector = 2 4 8 16 32 append = 64 vector = 2 4 8 16 32 64 append = 128 vector = 2 4 8 16 32 64 128 append = 256 vector = 2 4 8 16 32 64 128 256 append = 512 vector = 2 4 8 16 32 64 128 256 512 append = 1024 vector = 2 4 8 16 32 64 128 256 512 1024

Suggested Problems

More from this Author6