From: Matt S Trout Date: Sun, 10 May 2009 17:11:52 +0000 (+0100) Subject: first cut at info X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=67e9aef24811f3f4835f7aab3862911d0dbe49f4;p=engit%2FIron-Munger.git first cut at info --- diff --git a/answer.pl b/answer.pl new file mode 100644 index 0000000..2173821 --- /dev/null +++ b/answer.pl @@ -0,0 +1,24 @@ + +sub check_post_gap (@posts) { + my $next_post = shift(@posts); + my $success = 1; + foreach my $post (@posts) { + return $success if $next_post->at - $post->at > 7->days; + $success++; + $next_post = $post; + } + return $success; +} + +sub check_posts_rolling (@posts) { + return @posts if @posts <= 3; + my @next_post = splice(@posts, 0, 3); + my $success = 3; + foreach my $post (@posts) { + return $success if $next_post[0]->at - $post->at > 30->days; + $success++; + shift(@next_post); + push(@next_post, $post); + } + return $success; +}