Monday, September 3, 2007

Is My Membership Due?

Dijkstra's Algorithm by riggzy

Here's an algorithm puzzle I came across this morning. It requires simple logic but is harder than it seems. Check how long does it take you to do it:

You have two dates, both in mm/dd/yyyy format. One is the day you last renewed your library membership and the other is today. Write an algorithm [using simple pseudocode] to determine whether your library membership has expired or not. Remember, the only variables you can use are the mm, dd and yyyy values of the two dates.

Membership renewal date : mm1 / dd1 / yyyy1
Today's date : mm2 / dd2 / yyyy2

No PLs what-so-ever. Simple English.

No comments: