I had this questions on the first phone screening. How would have people done this. Will try to explain as cleanly as possible with examples.

  1. The input is a list of cards. The output is 3 cards which satisfy both of the following conditions:
  • Card can be all be either the same character or different
  • Each card can be all the same length or different length.

Input = A C C C | Output = C C C (we can have all cards same character and all same length)
Input = B B C CC A AA | Output = B C A (We can have all different character and same length)
Input = A B BB CC CCC | Output = A BB CCC (All different character and different length)