You will be given an input number as a char (e.g., x = '1233').
You have to figure out the dechiper keys and match it with given input and decipher it
ref=[0 1 2 3 4 5 6 7 8 9 ]; decipher_key_1=[ 1 2 3 4 5 6 7 8 9 0] ;decipher_key_2=[ 3 4 5 6 7 8 9 0 1 2];
decipher_key_3=[ 2 3 4 5 6 7 8 9 0 1];decipher_key_4=[ 2 3 4 5 6 7 8 9 0 1];
---> These are not real keys , just an example
eg x=1233 and y=1
output =2555
if x=2555 y=2
output =1233
Hint : index : 1-> key 1
2> key 2
3 -> key 3
4-> key 4
5_> key 5
up to key 10 .............................
if the number of digits exceeds 10 , 11 th digit must have the 1st key and 2nd key for 12th and so on.
"If" and "while" are forbidden.
Solution Stats
Problem Comments
4 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers8
Suggested Problems
-
Convert a vector into a number
614 Solvers
-
571 Solvers
-
529 Solvers
-
497 Solvers
-
6254 Solvers
More from this Author33
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
There are several bugs in the testsuite:
1) You cannot call cyp((x,y)) with double parantheses (occures twice)
2) for x='97256528638204' the string is too short. Likely there is a leading zero missing.
A few of the errors have been fixed, but this problem is too cryptic (or erroneous) for me to understand it, so I can't completely fix it. @Sibi, please fix the problem. I would highly recommend providing your own reference solution on the Edit page to ensure that it is working properly.
Ok, so there is a problem with test#3 because the input number has 14 digits, but the output number has 15 digits, which means the input is missing a leading 0. Until this is fixed, we need to manually add a leading 0 whenever the test#3 input is found, which is probably different from what the author wished because the number of leading 0s changes which key is applied to each position (confirming cokakola's suspicion).
Unfortunately this problem has too many restrictions and issues with some of the tests without any clear instructions from @Sibi on how to handle them.