code incognito - INVENTON

in the event CODE INCOGNITO there was a question of INVENTON, i compared many test cases from successful submission with my submission all outputs were same but still giving me a wrong answer

can any one help me to figure out where the testcases are failing and why , below is the link of my answer

how about


should give


@joffan can you explain why is the approach “log2(n) + 1” not giving correct answer?

can you please help me to figure out why the expected result is not coming in the 1st one

You probably don’t have enough precision on log2() to distinguish nearly-59 from 59. Which is why I chose this example.

1 Like

Precision on the log result. There can be 18 digits in the source number and you probably aren’t getting that many signficant figures for the log.

1 Like