mirror of
https://github.com/TheAlgorithms/Ruby
synced 2025-01-29 20:34:27 +01:00
Update number_of_days.rb
This commit is contained in:
parent
e804e6814c
commit
20a79f924b
1 changed files with 3 additions and 2 deletions
|
@ -15,10 +15,11 @@
|
|||
|
||||
|
||||
#
|
||||
# Approach 1: Using Date.parse
|
||||
# Approach 1: Using Ruby built-in Date.parse
|
||||
# Time complexity: O(1)
|
||||
# Space complexity: O(1)
|
||||
#
|
||||
|
||||
require 'date'
|
||||
|
||||
def number_of_days(date1, date2)
|
||||
|
@ -31,4 +32,4 @@ puts number_of_days("2019-06-29", "2019-06-30")
|
|||
# => 1
|
||||
|
||||
puts number_of_days("2020-01-15", "2019-12-31")
|
||||
# => 15
|
||||
# => 15
|
||||
|
|
Loading…
Add table
Reference in a new issue