Handshake task- DP instead of Catalan numbers