Given a string of letters a, b, n how many different ways can you make the word "banana" by crossing out various letters and then reading left-to-right?
(Use - to indicate a crossed-out letter)
Example
Input
bbananana
Output
b-anana--
b-anan--a
b-ana--na
b-an--ana
b-a--nana
b---anana
-banana--
-banan--a
-bana--na
-ban--ana
-ba--nana
-b--anana
This challenge comes from dinglemouse on CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge idea for a future post? Email yo+challenge@dev.to with your suggestions!
Top comments (4)
Umm... I feel there is another good solution🤔
Solution using Python3
Typescript:
Is the input wrong? Are there supposed to be two b's?
Yes.