|
1 | 1 | # Description |
2 | 2 |
|
3 | | -Calculate the date of meetups. |
4 | | - |
5 | | -Typically meetups happen on the same day of the week. In this exercise, you |
6 | | -will take a description of a meetup date, and return the actual meetup date. |
| 3 | +In this exercise, you will be given a general description of a meetup date and then asked to find the actual meetup date. |
7 | 4 |
|
8 | 5 | Examples of general descriptions are: |
9 | 6 |
|
10 | | -- The first Monday of January 2017 |
11 | | -- The third Tuesday of January 2017 |
12 | | -- The wednesteenth of January 2017 |
13 | | -- The last Thursday of January 2017 |
| 7 | +- First Monday of January 2022 |
| 8 | +- Third Tuesday of August 2021 |
| 9 | +- Teenth Wednesday of May 2022 |
| 10 | +- Teenth Sunday of July 2021 |
| 11 | +- Last Thursday of November 2021 |
14 | 12 |
|
15 | | -The descriptors you are expected to parse are: |
16 | | -first, second, third, fourth, fifth, last, monteenth, tuesteenth, wednesteenth, |
17 | | -thursteenth, friteenth, saturteenth, sunteenth |
| 13 | +The descriptors you are expected to process are: `first`, `second`, `third`, `fourth`, `fifth`, `last`, `teenth`. |
18 | 14 |
|
19 | | -Note that "monteenth", "tuesteenth", etc are all made up words. There was a |
20 | | -meetup whose members realized that there are exactly 7 numbered days in a month |
21 | | -that end in '-teenth'. Therefore, one is guaranteed that each day of the week |
22 | | -(Monday, Tuesday, ...) will have exactly one date that is named with '-teenth' |
23 | | -in every month. |
| 15 | +Note that descriptor `teenth` is a made-up word. |
| 16 | +There are exactly seven numbered days in a month that end with "teenth" ("thirteenth" to "nineteenth"). |
| 17 | +Therefore, it is guaranteed that each day of the week (Monday, Tuesday, ...) will have exactly one numbered day ending with "teenth" each month. |
24 | 18 |
|
25 | | -Given examples of a meetup dates, each containing a month, day, year, and |
26 | | -descriptor calculate the date of the actual meetup. For example, if given |
27 | | -"The first Monday of January 2017", the correct meetup date is 2017/1/2. |
| 19 | +For example, if given "First Monday of January 2022", the correct meetup date is January 3, 2022. |
0 commit comments