How many days are we represented in a foreign country?
Description:
How many days are we represented in a foreign country?
My colleagues make business trips to a foreign country. We must find the number of days our company is represented in a country. Every day that one or more colleagues are present in the country is a day that the company is represented. A single day cannot count for more than one day.
Write a function that recieves a list of pairs and returns the number of days that the company is represented in the foreign country. The first number of the pair is the number of the day of arrival and the second number of the pair is the day of departure of someone who travels, i.e. 1 january is number 1 and 31 of december is 365.
Example:
days_represented([[10,17],[200,207]])
Returns 16 because there are two trips of 8 days, which add up to 16.
Happy coding and rank this kata if you wish ;-)
Similar Kata:
Stats:
Created | Apr 8, 2017 |
Published | Apr 8, 2017 |
Warriors Trained | 5553 |
Total Skips | 149 |
Total Code Submissions | 21921 |
Total Times Completed | 2272 |
Haskell Completions | 83 |
Java Completions | 383 |
JavaScript Completions | 865 |
Python Completions | 882 |
C Completions | 66 |
Rust Completions | 62 |
Nim Completions | 9 |
Total Stars | 59 |
% of votes with a positive feedback rating | 87% of 521 |
Total "Very Satisfied" Votes | 418 |
Total "Somewhat Satisfied" Votes | 74 |
Total "Not Satisfied" Votes | 29 |
Total Rank Assessments | 10 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |