Triangle Type: Medium Programming Problem