Cody

Problem 44133. Find my secret function IV

Solution 2954758

Submitted on 16 Sep 2020 by Rafael S.T. Vieira
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
filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'for')),'for command is forbidden') assert(isempty(strfind(filetext, 'while')),'while command is forbidden') assert(isempty(strfind(filetext, 'find')),'find command is forbidden') assert(isempty(strfind(filetext, 'repelem')),'repelem command is forbidden') assert(isempty(strfind(filetext, 'discretize')),'discretize command is forbidden') assert(isempty(strfind(filetext, 'str2num')),'str2num command is forbidden')

2   Pass
x = 23; y_correct = 3; assert(isequal(your_fcn_name(x),y_correct))

3   Pass
x = 1000; y_correct = 163; assert(isequal(your_fcn_name(x),y_correct))

4   Pass
x = 10000; y_correct = 1224; assert(isequal(your_fcn_name(x),y_correct))

5   Pass
x = 9999999; y_correct = 664574; assert(isequal(your_fcn_name(x),y_correct))

Suggested Problems

More from this Author14

Community Treasure Hunt

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

Start Hunting!