Roblox interview question

Maximize potential energy for puzzle paths