<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Solving Dustin Diaz&#8217; programming brain teaser</title>
	<atom:link href="http://www.jaisenmathai.com/blog/2008/07/07/solving-dustin-diaz-programming-brain-teaser/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jaisenmathai.com/blog/2008/07/07/solving-dustin-diaz-programming-brain-teaser/</link>
	<description>A blog about killer code</description>
	<pubDate>Wed, 19 Nov 2008 23:24:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: jaisen</title>
		<link>http://www.jaisenmathai.com/blog/2008/07/07/solving-dustin-diaz-programming-brain-teaser/#comment-225</link>
		<dc:creator>jaisen</dc:creator>
		<pubDate>Wed, 09 Jul 2008 00:14:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=33#comment-225</guid>
		<description>Nice...similar but slightly shorter than mine.  I added a few interesting solutions to the end of the blog post.</description>
		<content:encoded><![CDATA[<p>Nice&#8230;similar but slightly shorter than mine.  I added a few interesting solutions to the end of the blog post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Binny V A</title>
		<link>http://www.jaisenmathai.com/blog/2008/07/07/solving-dustin-diaz-programming-brain-teaser/#comment-224</link>
		<dc:creator>Binny V A</dc:creator>
		<pubDate>Tue, 08 Jul 2008 19:24:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=33#comment-224</guid>
		<description>My JS solution for this problem...

var arr = ['a', 'b', 'c', 'c', 'd','e', 'e', 'e', 'e', 'e', 'f', 'e', 'f', 'e', 'f', 'a', 'a', 'a', 'f', 'f', 'f'];
var last = '';
var second_last = '';
var opened = false;
var res = "";
for(var i in arr) {
	if(arr[i] == last &#38;&#38; last == second_last &#38;&#38; opened == false) {
		res += "";
		opened = true;
	}
	if(opened &#38;&#38; arr[i] != last) {
		res += "";
		opened = false;
	}
	
	second_last = last;
	last = arr[i];
	
	res += arr[i];
}
if(opened) res += "";
alert(res);
</description>
		<content:encoded><![CDATA[<p>My JS solution for this problem&#8230;</p>
<p>var arr = ['a', 'b', 'c', 'c', 'd','e', 'e', 'e', 'e', 'e', 'f', 'e', 'f', 'e', 'f', 'a', 'a', 'a', 'f', 'f', 'f'];<br />
var last = &#8221;;<br />
var second_last = &#8221;;<br />
var opened = false;<br />
var res = &#8220;&#8221;;<br />
for(var i in arr) {<br />
	if(arr[i] == last &amp;&amp; last == second_last &amp;&amp; opened == false) {<br />
		res += &#8220;&#8221;;<br />
		opened = true;<br />
	}<br />
	if(opened &amp;&amp; arr[i] != last) {<br />
		res += &#8220;&#8221;;<br />
		opened = false;<br />
	}</p>
<p>	second_last = last;<br />
	last = arr[i];</p>
<p>	res += arr[i];<br />
}<br />
if(opened) res += &#8220;&#8221;;<br />
alert(res);</p>
]]></content:encoded>
	</item>
</channel>
</rss>
