Remove nodes with a given value | Capital One Coding Question