Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Also, don't post your solutions publicly, they'll get indexed by search engines which will let people cheat by copying them.
Approved PHP and Shell
Thanks trashy_incel, I will remember to provide the test case while writing issues. Thanks for the tip too, now i only have to optimize my code becouse it times out
please use some common sense when you post issues: at least mention a test case for which you think the reference solution is incorrect (with the input value, the expected value and your own answer). i just pasted your solution in the trainer, after running i immediately see:
converted to binary:
1 --> 10
but you returned11
Note that your code uses a global variable
numberOf1
to maintain state, that's very bad practice. global variables keep their values between function calls. The tests call your function several times in a row.This comment is hidden because it contains spoiler information about the solution