CarGurus Interview Question

Simple hackerrank problem (easy level)