Could you be more specific on the underlying relationship between the input (timetable) and output (mean duration)? That is, among which group are you calculating the mean duration? From your example, there are only 2 groups of destinations, i.e., BOS and NYC, but why there are 3 values in the output? What's the mapping behind? Also, your problems including Part 1, 4, 5 are all based on single test, which allows hard-coded solution to lead.
Peng do share the grouping method cause it eludes me :)
There seems to be an error with the test suite: the first mean time should be 03:09:50 and not 03:09:05. And the test code should probably be abs(ttDur - Dur) <= duration([0 0 1]) (not 0.01).
This is not a solution. It returns just a single value instead of 3 and somehow works.
Eventually figured out the grouping method in this problem, which is not so obvious...
This is a proper solution and with small size.
Return the largest number that is adjacent to a zero
3770 Solvers
Find relatively common elements in matrix rows
872 Solvers
1168 Solvers
521 Solvers
1157 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!