Teradata interview question

Question from algorithms.