S&P Global interview question

Coalesce implementation