Cody

Problem 46943. Hash

Solution 3372613

Submitted on 25 Oct 2020 by Farhan Gony
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
filetext = fileread('Ciph.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden') assert(isempty(strfind(filetext, 'if')),'if is forbidden')

2   Pass
r = 20; x=[1 5 2 6]; y_correct =3748; assert(isequal(Ciph(x,r),y_correct))

3   Pass
r = 5; x=[5 6 3 2 6]; y_correct =12872; assert(isequal(Ciph(x,r),y_correct))

4   Pass
r = 40; x=[4 8 6 8 5]; y_correct =83139; assert(isequal(Ciph(x,r),y_correct))

5   Pass
r = 110; x=[5 1 2 6 1 6 5 1 6 5]; y_correct =7348387387; assert(isequal(Ciph(x,r),y_correct))

6   Pass
r = 10085; x=[5 1 6 5 1 6 5 1 5]; y_correct =162162161; assert(isequal(Ciph(x,r),y_correct))

Suggested Problems

More from this Author4

Community Treasure Hunt

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

Start Hunting!