*@paramyear *@return*/publicbooleanisLeapYear(intyear){// 普通闰年,能被4整除,但是后两位不以00结尾if(year%4==0&& year%100!=0) {returntrue; }// 世纪闰年,后两位以00结尾,且能被400整除if(year%100==0&& year%400==0) {returntrue; }returnfalse; } 小结 算法专题目前已更新LeetCode算法题文...
【leetcode】1154. Day of the Year 题目如下: Given a stringdaterepresenting aGregorian calendardate formatted asYYYY-MM-DD, return the day number of the year. Example 1: Input: date = "2019-01-09" Output: 9 Explanation: Given date is the 9th day of the year in 2019. Example 2: Inpu...
1. Leetcode_easy_1154. Day of the Year; 完
1154. Day of the Year # 题目 # Given a string date representing a Gregorian calendar date formatted as YYYY-MM-DD, return the day number of the year. Example 1: Input: date = "2019-01-09" Output: 9 Explanation: Given date is the 9th day of the year in
date[4] == date[7] == ‘-’,其它的 date 都是数字 代码语言:javascript 代码运行次数:0 运行 AI代码解释 classSolution{publicintdayOfYear(String date){int totalDays=0;int year=Integer.parseInt(date.substring(0,4));int month=Integer.parseInt(date.substring(5,7));int day=Integer.parseInt(dat...
My Solutions to Leetcode problems. All solutions support C++ language, some support Java and Python. Multiple solutions will be given by most problems. Enjoy:) 我的Leetcode解答。所有的问题都支持C++语言,一部分问题支持Java语言。近乎所有问题都会提供多个算
1185. Day of the Week # 题目# 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 the following values {"Sunday", "Monday", "Tuesday", "Wednesday", ...
今天介绍的是LeetCode算法题中Easy级别的第261题(顺位题号是1154)。给定表示格式为YYYY-MM-DD的公历日期的字符串日期,返回该日期在年份中的编号。例如: 输入:date ="2019-01-09" 输出:9 说明:给定日期是2019年的第9天。 输入:date ="2019-02-10" 输出:41 输入:date ="2003-03-01" 输出:60 输入:date...
[LeetCode] 1185. Day of the Week 一周中的第几天,Givenadate,returnthecorrespondingdayoftheweekforthatdate.Theinputisgivenasthreeintegersrepresentingthe day, month and year respec...
1154 Day of the Year 一年中的第几天 Description: Given a string date representing a Gregorian calendar date formatted as YYYY-MM-DD, return the day number of the year. Example: Example 1: Input: date = "2019-01-09" Output: 9