This question should be modified, it’s not just poorly written, but it’s also not quite right.

You want us to return a power of two that is “greater” than the current element, but weirdly you want the function to return 2 when given 2.

please look into this.

1 Like

I’m trying to solve it the right way and make it return 4 when given 2, but it refuses the answer and flags it as a wrong answer.

This is supposed to be right:

Only when I agree on the terrible mistake that 2 is the smallest power that is greater than 2 it accepts my solution.

This is the one that you want to be right:

It’s also worth mentioning that there is another bug, it accepts an answer where K initially starts with 1, when it should actually start with 2, so that when this function is given 1, it should return 2 instead of 1. But this one doesn’t bother me a lot because at least it also accepts it when I change it to 2.

Again, please look into this.

1 Like