1
2
3
4
5
6
|
import datetime
class Solution:
def dayOfYear(self, date: str) -> int:
year,month,days=map(int, date.split('-'))
ans=datetime.date(year,month,days).timetuple().tm_yday
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 1752. Check if Array Is Sorted and Rotated (0) | 2022.04.18 |
---|---|
leetcode 1796. Second Largest Digit in a String (0) | 2022.04.18 |
leetcode 796. Rotate String (0) | 2022.04.18 |
leetcode 202. Happy Number (0) | 2022.04.18 |
leetcode 1903. Largest Odd Number in String (0) | 2022.04.14 |
댓글