Gray similar Code

Sir, is there any way to identify pigeonhole principle problem?

hi,

The pigeon hole principle when put into words would look like this

The abstract formulation of the principle: Let X and Y be finite sets and let f:A -> B be a function.

If X has more elements than Y, then f is not one-to-one.
If X and Y have the same number of elements and f is onto, then f is one-to-one.
If X and Y have the same number of elements and f is one-to-one, then f is onto.

This has quoted good examples, basically when no of objects that need to be allocated are more than no of space that is with us.
question like DIVISIBLE SUBARRAYS is also an example of pigeonhole principle.