leetcode 325 python, 3 safety checks sodexo