S&P Global interview question

Mapping out the logic of an algorithm.