pattern matching interview question