solve remove nth node from end of list and valid parentheses