Simple Fun #193: Moment Of Time In Space
Description:
Task
You are given a moment
in time and space. What you must do is break it down into time and space, to determine if that moment is from the past, present or future.
Time
is the sum of characters that increase time (i.e. numbers in range ['1'..'9']
.
Space
in the number of characters which do not increase time (i.e. all characters but those that increase time).
The moment of time is determined as follows:
If time is greater than space, then the moment is from the future.
If time is less than space, then the moment is from the past.
Otherwise, it is the present moment.
You should return an array of three elements, two of which are false, and one is true. The true value should be at the 1st, 2nd or 3rd
place for past, present and future
respectively.
Examples
For moment = "01:00 pm"
, the output should be [true, false, false]
.
time equals 1, and space equals 7, so the moment is from the past.
For moment = "12:02 pm"
, the output should be [false, true, false]
.
time equals 5, and space equals 5, which means that it's a present moment.
For moment = "12:30 pm"
, the output should be [false, false, true]
.
time equals 6, space equals 5, so the moment is from the future.
Input/Output
[input]
stringmoment
The moment of time and space that the input time came from.
[output]
a boolean array
Array of three elements, two of which are false, and one is true. The true value should be at the 1st, 2nd or 3rd place for past, present and future respectively.
Similar Kata:
Stats:
Created | Mar 10, 2017 |
Published | Mar 10, 2017 |
Warriors Trained | 1818 |
Total Skips | 23 |
Total Code Submissions | 2328 |
Total Times Completed | 939 |
JavaScript Completions | 401 |
C# Completions | 116 |
Python Completions | 391 |
Ruby Completions | 51 |
C Completions | 46 |
Total Stars | 9 |
% of votes with a positive feedback rating | 89% of 200 |
Total "Very Satisfied" Votes | 165 |
Total "Somewhat Satisfied" Votes | 26 |
Total "Not Satisfied" Votes | 9 |
Total Rank Assessments | 6 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |