leetcode121,Leetcode - 142. Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. 分析: 假设这个链表如图所示,链表长度为L,相遇点是6节点,起始点到环开始点距离为a,环开始点到相遇点距离为x。设慢指针速度为1,
时间:2023-09-25  |  阅读:23
leetCode,LeetCode-402:移除k位数字
题目描述: 给定一个以字符串表示的非负整数num,移除这个数中的 k 位数字,使得剩下的数字最小。 注意: leetCode,num 的长度小于 10002 且≥ k。 num 不会包含任何前导零。 示例 1 : 输入: num = "1432219", k = 3 输出: "1219"
时间:2023-09-22  |  阅读:25
leetcode973,贪心——雪糕的最大数量(Leetcode 1833)
题目选自Leetcode 1833 很简单的一道题,用来熟悉对vector的一些操作还是不错的 leetcode973。直接用sort从小到大排序,然后依次进行比较,每次更新剩余的钱, 最后返回结果即可 解题代码: class Solution { public:int maxIceCream(vector&
时间:2023-09-22  |  阅读:24
python算法题库,leetcode 1185 python
题目要求: https://leetcode-cn.com/problems/day-of-the-week/submissions/ import datetime class Solution:def dayOfTheWeek(self, day: int, month: int, year: int) -> str:l = ["Monday", "Tuesday","Wednesday", "Thursday
时间:2023-09-21  |  阅读:25
python算法题库,leetcode 1184 python
题目要求: https://leetcode-cn.com/problems/distance-between-bus-stops/submissions/ 思路: 注意start有可能大于destination的情况。 class Solution:def distanceBetweenBusStops(self, distance: List[int], start: int, destination: int) -> int:a &
时间:2023-09-21  |  阅读:25
python算法题库,leetcode 1160 python
题目要求: https://leetcode-cn.com/problems/find-words-that-can-be-formed-by-characters/ python中all函数用法: all() 函数用于判断给定的可迭代参数 iterable 中的所有元素是否都为 TRUE,如果是返回 True,否则返回 False。 元素除了是 0、空
时间:2023-09-21  |  阅读:24
python算法题库,leetcode 1164 python
题目要求: https://leetcode-cn.com/problems/day-of-the-year/ python中strptime函数的用法: https://www.runoob.com/python/att-time-strptime.html import time class Solution:def dayOfYear(self, date: str) -> int:return time.strptime(date, "
时间:2023-09-21  |  阅读:23
python算法题库,leetcode 190 python
python中进制转化的内置函数: https://blog.csdn.net/xdreamman/article/details/93497535 python中zfill自动补齐函数: https://www.runoob.com/python3/python3-string-zfill.html python中bin函数: https://www.runoob.com/python/python-func-bin.ht
时间:2023-09-21  |  阅读:23
python算法题库,leetcode 92 python
题目要求: https://leetcode-cn.com/problems/reverse-linked-list-ii/
时间:2023-09-21  |  阅读:26
python算法题库,leetcode 151 python
题目要求: https://leetcode-cn.com/problems/reverse-words-in-a-string/ split()当不带参数时以空格进行分割(不管几个空格全部砍掉),当代参数时,以该参数进行分割。 python 字符串(str)和列表(list)的互相
时间:2023-09-21  |  阅读:23

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息