Cody

Problem 44133. Find my secret function IV

Solution 1174442

Submitted on 28 Apr 2017 by Jean-Marie Sainthillier
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))

ans = 3

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

ans = 163

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

ans = 1224

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

ans = 664574

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!