代码如下: classSolution(object):defdayOfTheWeek(self, day, month, year):""":type day: int :type month: int :type year: int :rtype: str"""week= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]importdatetime whatday= datetime.datetime(year, month, day).strftime("%w")returnweek[int(whatday)]
https://github.com/grandyang/leetcode/issues/1185 参考资料: https://leetcode.com/problems/day-of-the-week/ https://leetcode.com/problems/day-of-the-week/discuss/377384/JavaC%2B%2BPython-Zeller-Formula https://leetcode.com/problems/day-of-the-week/discuss/381894/JavaC%2B%2BPython3-Sakamo...
https:///grandyang/leetcode/issues/1185 参考资料: https://leetcode.com/problems/day-of-the-week/ https://leetcode.com/problems/day-of-the-week/discuss/377384/JavaC%2B%2BPython-Zeller-Formula https://leetcode.com/problems/day-of-the-week/discuss/381894/JavaC%2B%2BPython3-Sakamoto-Algorith...
[leetcode] 1185. Day of the Week Description Given a date, return the corresponding day of the week for that date. The input is given as three integers representing the day, month and year respectively. Return the answer as one of th......
这个题和1185. Day of the Week类似。这个题中计算出当年是不是闰年,然后计算和1月1号之间的天数就行了,需要累加每个月,特别注意二月份。 C++代码如下: class Solution { public: int dayOfYear(string date) { int year = stoi(date.substr(0, 4)); ...
(本文部分解法参考Leetcode官方Solution) 30-Day LeetCoding Challenge原网址: Explore - LeetCodeleetcode.com/explore/challenge/card/30-day-leetcoding-challenge/528/week-1/ Week 1传送门: 爱吃咖喱的皮特:30-Day LeetCoding Challenge思路+代码分享-Week1(持续更新)3 赞同 · 0 评论文章 Week 3传送门...
classSolution:deftwoSum(self,nums:List[int],target:int)->List[int]:hashmap={}foritinrange(len(nums)):num=nums[it]diff=target-numifhashmap.get(num,None)isnotNone:#hashmap contains the other half of this numberreturn[hashmap[num],it]else:# hashmap not contain what we want# save the...
题目链接 LeetCode 72. 编辑距离[1] 题目描述 给你两个单词 word1 和word2,请你计算出将 word1 转换成 word2 所使用的最少操作数 。 你可以对一个单词进行如下三种操作: 插入一个字符 删除一个字符 替换一个字符 示例1 代码语言:javascript 代码运行次数:0 运行 AI代码解释...
They included the markup language for code blocks in the code itself and said “ope, i guess the code doesn’t work lol” when leetcode failed to run it. They also *only* included prime numbers in their dataset when asking ChatGPT if the numbers were prime or not, resulting in both ...
leetcode / solution / 1100-1199 / 1154.Day of the Year / README_EN.md README_EN.md 3.18 KB 一键复制 编辑 原始数据 按行查看 历史 ylb 提交于 2年前 . style: format inline code block (#1038) Loading... 跳转 举报 举报成功 我们将于2个工作日内通过站内信反馈...