Went on writing purely functional LCS DP solution