Square | Phone | Sock Pairs

Question:
You are given information on a Sock object such as color and foot (left or right). For example, consider the below as input:

  1. black and left
  2. pink and right
  3. pink and left
  4. black and right
  5. black and right

You have to write a method which takes the following input and return the list of Sock object pairs (same color, different foot) which are:

(1, 4) *OR *(1, 5)
(2, 3)

Note if a sock is repeated in a pair then only return 1 pair where that sock is used.

Comments (22)