you_config
you_config
全部文章
分类
归档
标签
去牛客网
登录
/
注册
you_config的博客
全部文章
(共9篇)
题解 | 简单错误记录
import collections info = collections.defaultdict(list) count = 0 q = [] #先后顺序保存错误信息,仅保存名称和行数,已经出现过的不加入q中 while 1: try: file, row = map(s...
2025-04-30
0
17
题解 | 购物单
01背包动态规划的递归解法,自己想了很久,没参考任何人的答案,但不幸的是会超时或者超空间,毕竟也是辛苦想出来的解法还是写一下。如果有改进意见的欢迎指正。 import functools n, m = map(int, input().split()) price = [] content = []...
2025-04-30
0
23
题解 | 分割回文串
class Solution: def partition(self , s ): # write code here res = [] def dfs(i, tmp): if i == len(s): ...
2025-04-29
0
22
题解 | 解密
class Solution: def numDecodings(self , s ): # write code here if s == '' or s[0] == '0': return 0 dp = [1]*(l...
2025-04-29
0
14
题解 | 判断回文串
# # # @param s string字符串 # @return bool布尔型 # class Solution: def isPalindrome(self , s ): # write code here d = [] for c...
2025-04-28
0
20
题解 | 最长合成字符串
# -*- coding:utf-8 -*- class LongestString: def getLongest(self, s, n): # write code here s.sort(key=lambda x:len(x),reverse = Tr...
2025-04-28
0
22
题解 | 求二叉树的前序遍历
# class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # # # @param root TreeN...
2025-03-04
0
41
题解 | 不同的二叉搜索树
# # # @param n int整型 # @return int整型 # class Solution: def numTrees(self , n ): # write code here def function(k): i...
2025-03-04
0
35
题解 | 判断二叉树是否为平衡二叉树
# class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # # # @param root TreeNo...
2025-03-03
0
33