Programming challenge

Sasha Pachev sasha at
Thu Sep 27 15:44:45 MDT 2007

Ok, enough of philosophical discussions about computer science, lets
see how good we are at solving practical problems. This is the one I
had to solve yesterday, by the way.


Given a string that could contain arithmetic expressions, with the
addition that numeric constants could be potentially expressed as
times, e.g 1:36 for 96 seconds, or 2:10:08 for 2 hours 10 minutes and
8 seconds, also decimal fractions after seconds are allowed, e.g
3:45.6 or 3:40:50.67, replace all the time values with their
equivalent number of seconds.

Solution language: Anything you want.

Extra credit: minimum development time, minimum execution time, do it
in one pass of the string (looking at each character no more than
once, related to minimum execution time), do it in one nasty Perl
statement (can this be done at all?), do it in Javascript (to offload
the web server, desktops have lots CPU cycles that the user absolutely
does not care about, good response time for the user, less load on the
web server)

Reward: public exposure of your skills, increased pool of references
when trying to get a hot job, possibly a good job offer from somebody
on the PLUG.

Sasha Pachev
AskSasha Linux Consulting

More information about the PLUG mailing list