Gap Inc. interview question

Write a function to do XYZ