陈文泰
陈文泰
全部文章
分类
题解(65)
归档
标签
去牛客网
登录
/
注册
White Wolf
Geralt
全部文章
(共65篇)
题解 | #最长公共子序列-II#
dp数组里存放LCS # # longest common subsequence # @param s1 string字符串 the string # @param s2 string字符串 the string # @return string字符串 # class Solution: ...
2021-07-28
0
351
题解 | #合并区间#
没有奇技淫巧,先对start排序,再逐个比较 # class Interval: # def __init__(self, a=0, b=0): # self.start = a # self.end = b # # # @param intervals ...
2021-07-28
0
351
题解 | #求路径#
动态规划 # # # @param m int整型 # @param n int整型 # @return int整型 # class Solution: def uniquePaths(self , m , n ): # write code here ...
2021-07-28
0
226
题解 | #链表内指定区间反转#
递归,先实现反转链表的前N个节点,再用递归来反转区间 # class ListNode: # def __init__(self, x): # self.val = x # self.next = None # # # @param head ListNo...
2021-07-28
0
350
题解 | #二叉树根节点到叶子节点的所有路径和#
helper函数:给定当前结点root和当前的路径和s,返回以root为根节点的树的路径和。 class Solution: def sumNumbers(self , root ): # write code here def helper(root, s)...
2021-07-27
0
232
题解 | #最小编辑代价#
dp解法的状态转移解释 int insert = dp[i][j-1] + 1; i个编辑成j-1个字符,再插入一个jint delete = dp[i-1][j] + 1; i-1个编辑成j个字母,再删除一个iint replace = dp[i-1][j-1] + 1; i-1个编辑成j-1个字...
2021-07-27
0
312
题解 | #矩阵的最小路径和#
dp # # # @param matrix int整型二维数组 the matrix # @return int整型 # class Solution: def minPathSum(self , matrix ): # write code here m...
2021-07-26
0
410
题解 | #数组中出现次数超过一半的数字#
hash表 # -*- coding:utf-8 -*- class Solution: def MoreThanHalfNum_Solution(self, numbers): # write code here from collections impor...
2021-07-26
0
206
题解 | #平衡二叉树#
# -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None cl...
2021-07-26
0
292
题解 | #单链表的排序#
归并排序。在sortInList中把链表从中间分成两份 # class ListNode: # def __init__(self, x): # self.val = x # self.next = None # # # @param head ListN...
2021-07-26
0
311
首页
上一页
1
2
3
4
5
6
7
下一页
末页