solution to triangle debugger