标签:sem set color asfasf math out str int print
问题:求两个串的最大子序列(并非连接的)
Java代码:
import java.util.Set; import java.util.StringJoiner; public class Main { public static int getL(String a, String b) { if (a.isEmpty()||b.isEmpty()) return 0; if (a.charAt(0) == b.charAt(0)) return getL(a.substring(1), b.substring(1)) + 1; else return Math.max(getL(a.substring(1), b), getL(a, b.substring(1))); } public static void main(String[] args) { int result = getL("abcfsdgsdgas", "xbaebcdasdasfasfdw"); System.out.println(result); } }
标签:sem set color asfasf math out str int print
原文地址:http://www.cnblogs.com/zszq/p/6370832.html