Goldman Sachs Interview Question

Write and explain code for Longest common subsequence and for lowest common ancestor.