- 博客(5)
- 收藏
- 关注
原创 middle题目
print(reverse_words("Hello World")) # 输出: "World Hello"print(atoi("-91283472332")) # 输出: -2147483648。print(atoi("4193 with words")) # 输出: 4193。print(atoi("words and 987")) # 输出: 0。print(atoi(" -42")) # 输出: -42。print(atoi("42")) # 输出: 42。
2024-09-24 23:18:48
329
原创 easy题目
提示:一个数如果是2的幂,那么它的二进制表示中有且只有一个位是1,其余都是0。# 由于整数可能非常大,超过了标准数据类型可以表示的范围,所以需要使用字符串来表示整数,并通过模拟手算加法的方式来进行计算。# Reverse Linked List 定义一个函数,输入一个链表的头节点,反转该链表并输出反转后链表的头节点。print(is_power_of_two(1)) # True,因为 2^0 = 1。print(is_power_of_two(2)) # True,因为 2^1 = 2。
2024-09-24 23:17:55
921
原创 Leetcode刷题记录(Java)
找出该数组中满足其和 ≥ target 的长度最小的 连续子数组 [numsl, numsl+1, ..., numsr-1, numsr] ,并返回其长度。如果不存在符合条件的子数组,返回 0。给定一个含有 n 个正整数的数组和一个正整数 target。输入两个链表,找出它们的第一个公共节点。在节点 c1 开始相交。
2023-07-25 00:27:15
293
原创 python刷题记录
无重复字符的最长子串给定一个字符串,请你找出其中不含有重复字符的最长子串的长度。class Solution: def lengthOfLongestSubstring(self, s: str) -> int: occ_set=set() rk,ans=-1,0 n=len(s) for i in range(n): if i != 0: occ_set.re..
2021-04-04 18:07:59
296
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅