Point72·Data Scientist·Technical Phone Screen
- Given an 8-digit integer date key in YYYYMMDD format, write both a SQL expression and a Python function that convert it to a quarter label like 'YYYY-Qn'. The solution must validate the date (returning NULL or raising an error for impossible dates like month 13 or Feb 30), support an optional fiscal start month parameter, and handle string inputs with whitespace or leading zeros correctly.
“I thought I had this in the bag because I've written quarter logic before, but the fiscal year offset tripped me up badly.”