Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use dynamic programming. dp[i][j] will be the longest common prefix of A[i:] and B[j:].
The answer is max(dp[i][j]) over all i, j.
Solve with full IDE support and test cases