何成95
何成95
全部文章
分类
归档
标签
去牛客网
登录
/
注册
何成95的博客
全部文章
(共163篇)
题解 | 两个数组的交集
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param nums1 int整型一维数组 # @param nums2 int整型一维数组 # @return int整型一维数组 # class Solution: def inters...
2025-09-09
0
23
题解 | 字母异位词的长度
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param s string字符串 # @param c string字符串 # @return int整型 # class Solution: def isCongruent(self ,...
2025-09-09
0
15
题解 | 大整数哈希
n = int(input()) ans, dic = 0, dict() for i in range(1,n+1): x, y = map(int,input().split()) ans += i*dic.setdefault(x,0) dic[x] = y print...
2025-09-09
0
18
题解 | 自动管理停车场桩位系统
# -*- coding:utf-8 -*- class Solution: def __init__(self):#初始化车道 self.stack = [] def push(self, node): # write code here ...
2025-09-09
0
12
题解 | 栈和排序
'''如果栈顶元素大于 第i项到第n项的最大值,说明如果让这个元素出栈此时的字典序肯定会更大。 如果栈顶元素小于 第i项到第n项的最大值,那就让该元素入栈,因为让大的先出栈总总能保证字典序最大''' n = int(input()) p = list(map(int,input().split()...
2025-09-09
0
22
题解 | 字符串哈希
n = int(input()) print(len({input() for _ in range(n)}))
2025-09-01
0
16
题解 | 无法吃午餐的学生数量
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param students int整型一维数组 # @param sandwiches int整型一维数组 # @return int整型 # class Solution: def co...
2025-09-01
0
21
题解 | 吐泡泡
t = int(input()) for _ in range(t): s = input() stack = []#定义初始化空栈 for c in s: if len(stack)>0 and c=='O' and stack[-1]=='O': ...
2025-09-01
0
20
题解 | 【模板】队列操作
n = int(input()) ans = [] for _ in range(n): p = list(input().split()) if p[0]=='1':#`1 x`:将整数 x ( − 1 0 9 ≦ x ≦ 1 0 9 ) x(−10 9 ≦x≦10 9 ) 入队;...
2025-09-01
0
24
题解 | 两数之和
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param nums int整型一维数组 # @param target int整型 # @return int整型一维数组 # class Solution: def twoSum(sel...
2025-08-31
0
22
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页