<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Coding Kata – January 29 2010 – Playing Vegas</title>
	<atom:link href="http://www.chriscowdery.com/posts/149/feed" rel="self" type="application/rss+xml" />
	<link>http://www.chriscowdery.com/posts/149</link>
	<description>Coding, Design and all things Tech</description>
	<lastBuildDate>Sun, 13 Jun 2010 00:08:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Chris</title>
		<link>http://www.chriscowdery.com/posts/149/comment-page-1#comment-34</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 01 Feb 2010 04:49:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.chriscowdery.com/?p=149#comment-34</guid>
		<description>Or rather, it&#039;s the most efficient that I&#039;ve stumbled across/come up with ;)</description>
		<content:encoded><![CDATA[<p>Or rather, it&#8217;s the most efficient that I&#8217;ve stumbled across/come up with <img src='http://www.chriscowdery.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.chriscowdery.com/posts/149/comment-page-1#comment-33</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 01 Feb 2010 04:48:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.chriscowdery.com/?p=149#comment-33</guid>
		<description>Quite right you are! I did pull this from my MS interview, but hey, interesting to see we both got it. You also got the catch!

This is also the most efficient algorithm too, nice work! :)</description>
		<content:encoded><![CDATA[<p>Quite right you are! I did pull this from my MS interview, but hey, interesting to see we both got it. You also got the catch!</p>
<p>This is also the most efficient algorithm too, nice work! <img src='http://www.chriscowdery.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Kuchta</title>
		<link>http://www.chriscowdery.com/posts/149/comment-page-1#comment-31</link>
		<dc:creator>Kevin Kuchta</dc:creator>
		<pubDate>Sun, 31 Jan 2010 15:54:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.chriscowdery.com/?p=149#comment-31</guid>
		<description>Well, I got distracted by food last night, so I put this together this morning.  It&#039;s pseudo-code-tastic.

detectHand(int[] hand)

	//Do the first half of a counting sort
	int[] countedHand = new int[13]
	for each card in hand
		countedHand[hand]++
	
	//Go through each element in the counted array
	boolean foundThree=false
	boolean foundTwo=false
	for each count in countedHand
		if( count == 4)
			return &quot;Four of a kind&quot;
		else if( (foundThree &amp;&amp; count == 2) &#124;&#124; (foundTwo &amp;&amp; count == 3) )
			return &quot;Full house&quot;
		else if( foundTwo &amp;&amp; count == 2 )
			return &quot;Two of a kind&quot;
		else if( count == 3 )
			foundTwo = false
		else if( count == 2 )
			foundTwo = true
		end
	end
	if(foundThree)
		return &quot;Three of a kind&quot;
	else if(foundTwo)
		return &quot;Pair&quot;
	else
		return &quot;High Card&quot;
	end
end</description>
		<content:encoded><![CDATA[<p>Well, I got distracted by food last night, so I put this together this morning.  It&#8217;s pseudo-code-tastic.</p>
<p>detectHand(int[] hand)</p>
<p>	//Do the first half of a counting sort<br />
	int[] countedHand = new int[13]<br />
	for each card in hand<br />
		countedHand[hand]++</p>
<p>	//Go through each element in the counted array<br />
	boolean foundThree=false<br />
	boolean foundTwo=false<br />
	for each count in countedHand<br />
		if( count == 4)<br />
			return &#8220;Four of a kind&#8221;<br />
		else if( (foundThree &amp;&amp; count == 2) || (foundTwo &amp;&amp; count == 3) )<br />
			return &#8220;Full house&#8221;<br />
		else if( foundTwo &amp;&amp; count == 2 )<br />
			return &#8220;Two of a kind&#8221;<br />
		else if( count == 3 )<br />
			foundTwo = false<br />
		else if( count == 2 )<br />
			foundTwo = true<br />
		end<br />
	end<br />
	if(foundThree)<br />
		return &#8220;Three of a kind&#8221;<br />
	else if(foundTwo)<br />
		return &#8220;Pair&#8221;<br />
	else<br />
		return &#8220;High Card&#8221;<br />
	end<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Kuchta</title>
		<link>http://www.chriscowdery.com/posts/149/comment-page-1#comment-30</link>
		<dc:creator>Kevin Kuchta</dc:creator>
		<pubDate>Sat, 30 Jan 2010 23:14:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.chriscowdery.com/?p=149#comment-30</guid>
		<description>Heh, fun story- I got this question when I was interviewing in Redmond.  I got an answer, but it wasn&#039;t very elegant.  I&#039;ve got a few minutes, let&#039;s see if I can do better.</description>
		<content:encoded><![CDATA[<p>Heh, fun story- I got this question when I was interviewing in Redmond.  I got an answer, but it wasn&#8217;t very elegant.  I&#8217;ve got a few minutes, let&#8217;s see if I can do better.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
