CENTREE Wrong Answer: What's an example where it's wrong?

My attempted solution to CENTREE is here, which is wrong. However, I can’t figure out an example where it’s wrong; can you?

Thanks :slight_smile:

Your condition-

if n < 3 or b != 0 and n / b < 4:
        return None

is unable to handle this test case-

2 1
Your Output
Expected Output
1 2

I feel this should be only edge case here.

1 Like

You’re right, it’s correct when I add that edge case.

Unfortunately I don’t understand either of the edge cases :frowning: I thought n == 2 and b == 0 should be YES while n == 2 and b == 1 should be NO. Even after re-reading the question and constraints I don’t quite understand how the expected answer is what it is.

Nonetheless, thank you very much for your prompt response.

For n=2, the centre and centroid are different (considering the maximum of the pair). Hence for n=2, b=0 isnt possible.

For n=2,centers are 1 and 2,and centroids also are 1 and 2.If we take center 1 and centroid 2, we get b=1 .So when n=2 ,b can have only one value,which is b=1 .It is peculiar case ,so should be handled separately.