There is a group of n kids, numbered 0 through n-1, where n is an odd number.
Each kid has some friends within the group, and each kid knows how many friends each of the other kids has.
Friendship is symmetric, so if kid 0 is a friend of kid 1, then kid 1 is a friend of kid 0. Each kid i also
supports exactly one other kid (i+k) % n, not necessarily a friend.
You ask each kid to answer the following question: Consider each kid in the
group except yourself and the kid you support. What is the sum of the number of friends each of them has?
For example, if you ask kid 0 this question, and kid 0 supports kid 1,
he should tell you (the number of friends kid 2 has) + (the number of friends kid 3 has) + ... +
(the number of friends kid n-1 has).
You are given a int[] sumFriends, where the i-th element (0-indexed) is the answer given to
you by kid i. Some of the kids might not be telling the truth (they are just kids, forgive them).
Return "IMPOSSIBLE" if it is impossible for all the given answers to be accurate. Otherwise, return
"POSSIBLE" (all quotes for clarity).
|