Skip to content

Commit e46c027

Browse files
committed
Add solution #1360
1 parent bd2215f commit e46c027

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
1324|[Print Words Vertically](./1324-print-words-vertically.js)|Medium|
7373
1332|[Remove Palindromic Subsequences](./1332-remove-palindromic-subsequences.js)|Easy|
7474
1333|[Filter Restaurants by Vegan-Friendly, Price and Distance](./1333-filter-restaurants-by-vegan-friendly-price-and-distance.js)|Medium|
75+
1360|[Number of Days Between Two Dates](./1360-number-of-days-between-two-dates.js)|Easy|
7576

7677
## License
7778

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* 1360. Number of Days Between Two Dates
3+
* https://leetcode.com/problems/number-of-days-between-two-dates/
4+
* Difficulty: Easy
5+
*
6+
* Write a program to count the number of days between two dates.
7+
*
8+
* The two dates are given as strings, their format is `YYYY-MM-DD` as shown in the examples.
9+
*/
10+
11+
/**
12+
* @param {string} date1
13+
* @param {string} date2
14+
* @return {number}
15+
*/
16+
var daysBetweenDates = function(date1, date2) {
17+
return Math.abs(new Date(date1) - new Date(date2)) / (24 * 60 * 60 * 1000);
18+
};

0 commit comments

Comments
 (0)