Nicole_jian
Nicole_jian
全部文章
分类
归档
标签
去牛客网
登录
/
注册
Nicole_jian的博客
全部文章
(共104篇)
题解 | 查找组成一个偶数最接近的两个素数
import math def is_prime(num): if num <= 1: return False if num <= 3: return True if num % 2 == 0 or num % 3 == 0:...
2024-12-23
0
18
题解 | 删除字符串中出现次数最少的字符
s = input() counts = {} for char in s: if char not in counts: counts[char] = 0 counts[char] += 1 min_count = min(counts.values()) res...
2024-12-23
0
15
题解 | #搬圆桌#
import math while True: try: r, x, y, x1, y1 = map(int, input().split()) distance = math.sqrt((x - x1) ** 2 + (y - y1) ** 2) ...
2024-06-10
0
165
题解 | #最大乘积#
def max_product(nums): min1 = min2 = float('inf') max1 = max2 = max3 = float('-inf') for num in nums: if num < min1: ...
2024-06-10
0
138
题解 | #KiKi和酸奶#
#include<stdio.h> int main() { int n, h, m; while(scanf("%d %d %d", &n, &h, &m) != EOF) { printf("%d...
2024-06-03
0
141
题解 | #点击消除#
def optimize_delete(s): stack = [] for char in s: if not stack or stack[-1] != char: stack.append(char) else: ...
2024-06-01
0
126
题解 | #有效括号序列#
class Solution: def isValid(self, s: str) -> bool: # 定义一个字典用于匹配左右括号 bracket_map = {')': '(', '}': '{', ']': '['} # 初始化一...
2024-05-29
0
189
题解 | #逆波兰表达式求值#
from typing import List class Solution: def evalRPN(self, tokens: List[str]) -> int: # 初始化一个空栈,用于存储计算过程中的中间结果 stack = [] ...
2024-05-29
0
154
题解 | #逆波兰表达式求值#
from typing import List class Solution: def evalRPN(self, tokens: List[str]) -> int: stack = [] for token in tokens: ...
2024-05-29
0
148
题解 | #排序#
from typing import List class Solution: def MySort(self, arr: List[int]) -> List[int]: n = len(arr) # Traverse through all arr...
2024-05-29
0
163
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页