Abstract. The maximum common embedded subtree problem, which generalizes the minor containment problem on trees, is reduced for ordered trees to a variant of the longest common subsequence problem, called the longest common balanced sequence problem. While the maximum common embedded subtree problem is known to be APX-hard for unordered trees, an exact solution for ordered trees can be found in polynomial time. In this paper, a dynamic programming algorithm is presented that solves the longest common balanced sequence problem, and thus the maximum common embedded subtree problem, in O(n1n2min(d1,l1) min(d2,l2)) time, on ordered trees with n1 and n2 nodes, of depth d1 and d2, and with l1 and l2 leaves, respectively.