[Community puzzle] Number of letters in a number - Binary

This topic is about the puzzle Number of letters in a number - Binary.

Feel free to send your feedback or ask some help here!

Hello,
Cant pass the last validator… but i pass the last test.

Nice idea. I like the little trick in the last test cases

The little trick for the last one is indeed … tricky to find !!
:joy:

Interesting puzzle, I liked it. The test case names were a nice hint.

JS generators are timing out on me for the last testcase :frowning: gotta find a way around I guess
/e: recursion also going too deep, darn it :frowning:

I liked the puzzle, the last two cases make it interesting. To me it was helpful to look at the expected value.

// numbers used in the last test are too big for js
// (which is poor problem design, common thing on CG)
// but it still works by pure luck
// (or rather, by poor test case design, common thing on CG)

// also, lacks interesting cases with alternating repeating patterns
// instead of immediately repeting ones
// i.e. loops of length more than 1
// i am dissapoint

There are hints in the names of the testcases. Check them again and look at your optimizations

I hope this is not considered as a spoiler, feel free to delete this comment.

It seems there are no interesting patterns, as far as I can see.

edit: one could invent a new language with letter count 3 and 7 (instead of 3 and 4) or use numbers with base 3. But I guess it’s too late now.

edit2: deleted graph, as it spoils too much. The intension was to show, that the testcases are not poorly chosen, this was achieved.

3 Likes

It’s been taken out of the puzzle pre-validation, but in the author’s reference code, 0 -> 4. (It got taken out precisely because of the ambiguity)

Same thing! :confused:

I found a solution, you shall check the types of your variables! :wink:

+1 to check variable types. Especially in JS…
Had to port my solution to PHP (and pass) before figuring out what’s wrong with my JS-solution :slight_smile:

This puzzle is nuts. I found the pattern and solved the puzzle, But when submitting it tells me the last test is failing. Even though every single custom test returns the result as expected.

There’s a bug in the last one. I figured out the solution and did thorough testing and everything returns to the pattern. And all the tests pass. So something must be up.

There is no bug, you just didn’t find the right pattern.

You are so helpful , I think your pattern give the whole ans.

Looking back at my old post: you are right. One still has to understand the meaning though. I deleted the graph (but I can’t delete it from the post’s history).

Loved this puzzle, and especially the “trick” that appears at the end, and the smart hint in the test cases name. Lovely :slight_smile: