14
Oct
09

Average Arrival Time For A Flight, part 1

To be honest this was a bit of a disappointment when I first read it, but upon starting the challenge I realized there are way more subtleties than I first gave it credit for. My initial thought was to take a base time as milliseconds then convert all inputs to milliseconds, find the difference, average and put it back into regular hours. I started reading Date classes and found a pretty easy way to do this.
After working on this for a while I realized that I would have to use more than just DateTime. As usual, it was pretty much in the instructions to use Time. Once I brought that class in, this problem becomes pretty trivial. I’ll post my solution once it ends, but I think it’s pretty good. It’s only 18 lines, any tips on how to make it more Ruby-like would be much appreciated.

Advertisements

0 Responses to “Average Arrival Time For A Flight, part 1”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Challenges

How often I post

October 2009
M T W T F S S
« Sep   Dec »
 1234
567891011
12131415161718
19202122232425
262728293031  

This is everything


%d bloggers like this: