Excuse me! I want to delete the first my comment (but there is no such possibility on the site). I could not determine the algorithm for determining the secret word. And it was not possible for me to learn this algorithm. My opinion is that it would be easier if there were two tests in the task definition, simple and difficult (or medium).
Why not? How do you think this kata has been solved more than 17k times and nobody complained about that test?
As a simplification, you may assume that no letter occurs more than once in the secret string.
"mathisfun" has no repeated letters.
You can assume nothing about the triplets given to you other than that they are valid triplets and that they contain sufficient information to deduce the original string. In particular, this means that the secret string will never contain letters that do not occur in one of the triplets given to you.
With the input given you can recover "mathisfun". Seriously, I don't know what you meant there.
Please read the description again, ['c','b','a'] is not a valid triplet for the string "abc":
A triplet here is defined as a sequence of three letters such that each letter occurs somewhere before the next in the given string. "whi" is a triplet for the string "whatisup".
In the example it says that for input 531, the expected answer is 513.
Your error message says that your solution returned 531, but it should return -1, but you did not say what was the input number.
Excuse me! I want to delete the first my comment (but there is no such possibility on the site). I could not determine the algorithm for determining the secret word. And it was not possible for me to learn this algorithm. My opinion is that it would be easier if there were two tests in the task definition, simple and difficult (or medium).
Why not? How do you think this kata has been solved more than 17k times and nobody complained about that test?
"mathisfun" has no repeated letters.
With the input given you can recover "mathisfun". Seriously, I don't know what you meant there.
the test for 'whatisup' and the description of the problem condition are absolutely not suitable for the secret 'mathisfun'!!!
There is no such test, and mind your language.
Please read the description again, ['c','b','a'] is not a valid triplet for the string "abc":
This comment is hidden because it contains spoiler information about the solution
try:
secret441 = "abc"
triplets441 = [
['c','b','a'],
['a','b','c']
]
Not bad)
From the description:
So, the next smaller number from 100, isn't 010 (10)?
I don't get it.
Not a kata issue ...
@hobovsky it seems you had a typo on your post up there:
It should be 144, not 114.
Your observation is most probably incorrect.
In the example it says that for input
531
, the expected answer is513
.Your error message says that your solution returned
531
, but it should return-1
, but you did not say what was the input number.instresting observation
from the description
next_smaller(531) == 513
from the test
531 should equal -1
why the contradiction?
Loading more items...