So i was trying to solve this problem.
You are given a multiset of N integers. Please find such a nonempty subset of it that the sum of the subset's elements is divisible by N. Otherwise, state that this subset doesn't exist.
What i did was simply generate the combinations and check if each of them was divisible by its cardinality. This solution turned out just fine.
After the competetion i found an elegant solution here.
It so turns out that i cannot generate a sequence of n numbers without having a consecutive subset which is not a multiple of n.
That is to say, whatever combination of numbers i try..there always exists a consecutive subset which is a multiple of 'No. of numbers'(n).
Can anyone explain this theoritically? Or is there any theorem that states this?
PS: I already tried Googling it...all in vain.