Goldman Sachs OA 2026 | Longest Common Subsequence & Minimum Height Trees
GoldmanSachs · Question · Posted Jun 2026
Problem 1 - Maximum Common Data Lineage (Longest Common Subsequence) Problem Statement You are given two strings source and target. A subsequence is formed by deleting zero or more characters from a string while preserving the relative order of the remaining characters. Find the length of the longest subsequence that appears in both strings. Constraints Constraint 1 ≤ source.length ≤ 1000 1 ≤ target.length ≤ 1000 Strings contain lowercase English letters only Test Cases Input Output Explanation source = "abcde" ...
The full answer & interview discussion are available to premium members.
Log in Create a free account