Amazon Interview Question

Reverse Array Queries, and Validating Strings with Regex