Blist is a new online version of Access.   The people’s database, similar to Zoho.   I thought a recent post on their blog was interesting.   They’re looking for developers in Seattle.   Here is the instructions for the interested candidates:

 If you’re interested, send me an email. If you have a current resume, great. If not, we’ll get that later. I like to look at code, so send me some. Send me the solution to the following programming challenge:

Without using any built in date or time functions, write a function or method that accepts two mandatory arguments. The first argument is a string of the format “[H]H:MM {AM|PM}” and the second argument is an integer. Assume the integer is the number of minutes to add to the string. The return value of the function should be a string of the same format as the first argument. For example AddMinutes(”9:13 AM”, 10) would return “9:23 AM”. The exercise isn’t meant to be too hard. I just want to see how you code. Feel free to do it procedurally or in an object oriented way, whichever you prefer. Use any language you want. Write production quality code.

I look forward to hearing from you.

http://blist.com/blog/

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]


Comments

  1. 1
    Cris
    December 3rd, 2007 at 9:20 am

    If you think, at first, is a hard challenge, but afterwards you can see that it’s kind of simple. There’s no need of date or time functions, only math functions and some parsing. With some more parsing and validations, this functions should do the job.

    function AddMinutes($hourMinutes,$numOfMinutes)
    {
    # [H]H:MM {AM/PM}
    $time = explode(’ ‘,$hourMinutes);
    if(sizeof($time) > 1 && is_numeric($numOfMinutes))
    {
    # It has to have at least 2 parameters according to the specified argument
    $amPM = $time[1];
    if(in_array($amPM,array(’AM’,'PM’,'am’,'pm’)))
    {
    $parse_time = explode(’:',$time);
    if(sizeof($time) > 0 && is_numeric($parse_time[0]) && is_numeric($parse_time[1]))
    {
    $hour = $parse_time[0];
    $minutes = $parse_time[1];
    $min = $hour * 60;
    $new_time = $min + $minutes + $numOfMinutes;
    $new_hour = $new_time / 60;
    $new_minutes = $new_time % 60;
    $time_string = $new_hour.’:’.$new_minutes.’ ‘.$amPM;
    return $time_string;
    }
    return false;
    }
    return false;
    }
    return false;
    }

Leave a Comment

You must be logged in to post a comment.

blank