Below are four problems (two general CS questions, and two focused on using web APIs). Please read through all of the problems and make sure you understand them. If you have any questions about the problems, please get in touch with me before starting on the test.
Please finish the test to the best of your ability. It takes most people 2-3 hours to finish.
The problems may be solved using any programming language.
Please package your submission as you would package any code that you'd like to hand off to any other developer -- obviously runnable and testable.
Thank you, good luck, and have fun!
Solve these using any programming language you’d like.
Each element of text
is a line of prose from some passage. You will return a
string that is read downward, as opposed to left-to-right. That is, the first
element of text
will correspond to the first "column" of the returned
string, and so forth.
-
text will contain between 1 and 50 elements, inclusive.
-
Each element of text will contain between 1 and 50 characters, inclusive.
-
Each element of text will contain the same number of characters.
-
Each character in text 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 takes several days. Take a list of the times when the competitors crossed the finish line and convert that into the average number of minutes to complete the race.
The race starts on day 1 at 8:00 AM.
We are given a list of finish times as a string, where each finish time 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).
Create a class RaceAverage
containing a method avgMinutes
that is given a
list of strings, times
, and that 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.
-
"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
Use any language to solve these problems but you should not use any bitly API specific client libraries (e.g. bitly_api).
For reference you can find the docs for the bitly API at http://dev.bitly.com/.
One of the more interesting API endpoints offered by bitly is the hot phrases API. This endpoint returns a list of phrases and related content which is currently receiving a significant amount of clicks.
Query this endpoint to get the current hot phrases and return the top 5 phrases based on click rate. The final values returned should just be the phrases and none of the other data returned by the endpoint.
Below is a sample of what the output should look like (your phrases will be different but format should be the same):
breaking bad
miley cyrus
government shutdown
injury status of starting cornerbacks rashean mathis and chris houston
key questions
Another interesting API endpoint that bitly provides is the high value API. Similar to the hot phrases endpoint, the high value endpoint provides bitly links that are receiving a lot of attention right now.
Use the high value endpoint along with other parts of the bitly API to return a list of 10 high value links, along with the number of clicks each link has received in the last day.
Below is a sample of what the output should look like:
http://bit.ly/15clwC2 - 432
http://bit.ly/WT7zYR - 53
http://bit.ly/15BC7mu - 143
http://bit.ly/1eNqttq - 43
http://bit.ly/16qV1yX - 98
http://bit.ly/yGi1de - 483
http://bit.ly/1beexgs - 992
http://bit.ly/1bWh15V - 102
http://bit.ly/1bHafRm - 896
http://bit.ly/162Stn - 423
Again the specific links and counts you return will be different but the format should be the same.