Below are two simple programming problems that may be solved using any programming language. Please read through the requirements and ask any clarifying questions prior to starting the test — it typically takes 2-3 hours to complete.
Package your submission as you would package any code that you'd like to hand off to another developer.
Thank you, good luck, and have fun!
Write a function that takes a single argument, lines
, which is a list of
strings. Each element of lines
is a line of prose from some passage. You will
return a list of strings that is read "downward", as opposed to left-to-right.
That is, the first element of lines
will correspond to the first "column" of
the returned list, and so forth.
-
lines
will contain between 1 and 50 elements, inclusive. -
Each element of
lines
will contain between 1 and 50 characters, inclusive. -
Each element of
lines
will contain the same number of characters. -
Each character in
lines
will be an uppercase letter ([A-Z]
).
Input:
["AAA",
"BBB",
"CCC"]
Output:
["ABC",
"ABC",
"ABC"]
So, rows of the input become columns of the output.
Input:
["AAAAAAAAAAAAA"]
Output:
["A",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"A"]
Input:
["A",
"A",
"A",
"A",
"A"]
Output:
["AAAAA"]
There is a sailboat race from Rhode Island to Bermuda. It can take several days to finish.
Create a class, RaceAverage
, containing a method, avgMinutes
, that takes a
list of strings, times
, and returns the average number of minutes taken by
the competitors to complete the race. Round the returned value to the nearest
minute, with .5 rounding up.
Each finish time in times
is formatted as
hh:mm xM, DAY n
where hh
is exactly 2 digits giving the hour, mm
is exactly 2 digits giving
the minute, x
is either 'A'
or 'P'
, and n
is a positive integer less
than 100 with no leading zeros. So each string has exactly 15 or 16 characters
(depending on whether n is less than 10).
The race starts on day 1 at 8:00 AM.
-
"12:00 AM, DAY d"
refers to midnight between DAYd-1
and DAYd
-
"12:00 PM, DAY d"
refers to noon on DAYd
-
times
contains between 1 and 50 elements inclusive -
each element of
times
is formatted as specified above, withhh
between01
and12
inclusive,mm
between00
and59
inclusive, andd
between1
and99
inclusive -
each element of
times
represents a time later than the start of the race.
Input:
["12:00 PM, DAY 1",
"12:01 PM, DAY 1"]
Output:
241
From 8:00 AM to noon is 4 hours, so we have 4 hours for one competitor, and 4 hours, 1 minute for the other. These two values average to 240.5 minutes, which is rounded up.
Input:
["12:00 AM, DAY 2"]
Output:
960
The one competitor finished in 16 hours, just at the start of DAY 2.
Input:
["02:00 PM, DAY 19",
"02:00 PM, DAY 20",
"01:58 PM, DAY 20"]
Output:
27239