Townscript interview question

Dsa question 3 sum problem