7 kyu
Simple Fun #175: Same Encryption
149 of 423myjinxin2015
Description:
Task
John loves encryption. He can encrypt any string by the following algorithm:
take the first and the last letters of the word;
replace the letters between them with their number;
replace this number with the sum of it digits
until a single digit is obtained.
Given two strings(s1
and s2
), return true
if their encryption is the same, or false
otherwise.
Example
For s1 = "EbnhGfjklmjhgz" and s2 = "Eabcz"
, the result should be true
.
"EbnhGfjklmjhgz" --> "E12z" --> "E3z"
"Eabcz" --> "E3z"
Their encryption is the same.
Input/Output
[input]
strings1
The first string to be encrypted.
s1.length >= 3
[input]
strings2
The second string to be encrypted.
s2.length >= 3
[output]
a boolean value
true
if encryption is the same, false
otherwise.
Puzzles
Algorithms
Similar Kata:
Stats:
Created | Mar 1, 2017 |
Published | Mar 1, 2017 |
Warriors Trained | 795 |
Total Skips | 10 |
Total Code Submissions | 2238 |
Total Times Completed | 423 |
JavaScript Completions | 149 |
C# Completions | 59 |
Python Completions | 214 |
Ruby Completions | 37 |
Total Stars | 14 |
% of votes with a positive feedback rating | 89% of 139 |
Total "Very Satisfied" Votes | 112 |
Total "Somewhat Satisfied" Votes | 24 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 5 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |