https://leetcode-cn.com/problems/longest-uncommon-subsequence-i/
思路:
分条件判断
1,当a和b一样时,返回-1
2,当a的长度和b的长度一样但不相等时,则根据示例可知,a、b都是最长特殊序列
因为都是独有的的
3,当a和b长度不一样时,返回最长的即可,因为当a的长度大于b时,b中必定没有a长度的序列
https://leetcode-cn.com/problems/longest-uncommon-subsequence-i/
思路:
分条件判断
1,当a和b一样时,返回-1
2,当a的长度和b的长度一样但不相等时,则根据示例可知,a、b都是最长特殊序列
因为都是独有的的
3,当a和b长度不一样时,返回最长的即可,因为当a的长度大于b时,b中必定没有a长度的序列
上一篇:JDBC操作
下一篇:102. 二叉树的层序遍历
【数据结构】第三章——栈、队列与数组详细介绍特殊矩阵的压缩存储……
给你两个字符串 a 和 b,
522. 最长特殊序列 II给定字符串列表,...
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M