You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recurring monthly meetups are generally scheduled on the given weekday of a given week each month.
4
-
In this exercise you will be given the recurring schedule, along with a month and year, and then asked to find the exact date of the meetup.
3
+
Your task is to find the exact date of a meetup, given a month, year, weekday and week.
5
4
6
-
For example a meetup might be scheduled on the _first Monday_ of every month.
7
-
You might then be asked to find the date that this meetup will happen in January 2018.
8
-
In other words, you need to determine the date of the first Monday of January 2018.
5
+
There are five week values to consider: `first`, `second`, `third`, `fourth`, `last`, `teenth`.
6
+
7
+
For example, you might be asked to find the date for the meetup on the first Monday in January 2018 (January 1, 2018).
9
8
10
9
Similarly, you might be asked to find:
11
10
12
11
- the third Tuesday of August 2019 (August 20, 2019)
13
12
- the teenth Wednesday of May 2020 (May 13, 2020)
14
13
- the fourth Sunday of July 2021 (July 25, 2021)
15
14
- the last Thursday of November 2022 (November 24, 2022)
15
+
- the teenth Saturday of August 1953 (August 15, 1953)
16
16
17
-
The descriptors you are expected to process are: `first`, `second`, `third`, `fourth`, `last`, `teenth`.
18
-
19
-
Note that descriptor `teenth` is a made-up word.
20
-
21
-
It refers to the seven numbers that end in '-teen' in English: 13, 14, 15, 16, 17, 18, and 19.
22
-
But general descriptions of dates use ordinal numbers, e.g. the _first_ Monday, the _third_ Tuesday.
23
-
24
-
For the numbers ending in '-teen', that becomes:
25
-
26
-
- 13th (thirteenth)
27
-
- 14th (fourteenth)
28
-
- 15th (fifteenth)
29
-
- 16th (sixteenth)
30
-
- 17th (seventeenth)
31
-
- 18th (eighteenth)
32
-
- 19th (nineteenth)
17
+
## Teenth
33
18
34
-
So there are seven numbers ending in '-teen'.
35
-
And there are also seven weekdays (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday).
36
-
Therefore, it is guaranteed that each day of the week (Monday, Tuesday, ...) will have exactly one numbered day ending with "teen" each month.
19
+
The teenth week refers to the seven days in a month that end in '-teenth' (13th, 14th, 15th, 16th, 17th, 18th and 19th).
37
20
38
-
If asked to find the teenth Saturday of August, 1953 (or, alternately the "Saturteenth" of August, 1953), we need to look at the calendar for August 1953:
21
+
If asked to find the teenth Saturday of August, 1953, we check its calendar:
39
22
40
23
```plaintext
41
24
August 1953
@@ -48,4 +31,4 @@ Su Mo Tu We Th Fr Sa
48
31
30 31
49
32
```
50
33
51
-
The Saturday that has a number ending in '-teen' is August 15, 1953.
34
+
From this we find that the teenth Saturday is August 15, 1953.
0 commit comments