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

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

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 !!

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

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

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

1 Like

// 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!

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

+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

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