<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.thedailywtf.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Coder Challenge</title><link>http://forums.thedailywtf.com/forums/20.aspx</link><description>Sure, you can talk the talk, but can you code the ... erm ... code? Solve and share fun exercises in programming and development.</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Make a program that still runs if the lines are shuffled</title><link>http://forums.thedailywtf.com/forums/thread/149350.aspx</link><pubDate>Mon, 18 Feb 2008 05:00:23 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:149350</guid><dc:creator>zzo38</dc:creator><slash:comments>29</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/149350.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=149350</wfw:commentRss><description>&lt;p&gt;This is a new challenge. Make a program that still runs if the lines are shuffled. Another challenge is to make a program that still runs if the lines are shuffled and that one line at random might be taken out. Lines cannot be longer than 40 characters each. Use any program language, or preferably write it in multiple program languages to see which is easy and which are harder to do it. See if you can answer any of the other coder challenges on this web site using these harder challenges.&lt;/p&gt;
</description></item><item><title>Fibonacci Algorithm</title><link>http://forums.thedailywtf.com/forums/thread/285923.aspx</link><pubDate>Mon, 09 Apr 2012 09:01:21 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:285923</guid><dc:creator>Nagesh</dc:creator><slash:comments>22</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/285923.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=285923</wfw:commentRss><description>&lt;p&gt;
One question that is always ask for interview in India by my company is write algorithm to generate fibonacci algorithm. This is easy with three variables:
&lt;/p&gt;
int a = 0; &lt;br /&gt;
int b = 1;&lt;br /&gt;
int c = a + b;&lt;br /&gt;
int a = b;&lt;br /&gt;
int b = c;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;and this can be utilize in loop to print out the series. You can go till the int value is exhausted by compiler.&lt;/p&gt;

&lt;p&gt;Nagesh add one variation to it. Maybe smart coder on this site can solve quick. How can I give number and get the fibonacci number in that position.
Example: Tell me how to find the 17th fibonacci sequence.
&lt;/p&gt;


anyone up for this chalenge?
</description></item><item><title>Make a subtle memory leak</title><link>http://forums.thedailywtf.com/forums/thread/306412.aspx</link><pubDate>Sat, 13 Oct 2012 03:59:11 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:306412</guid><dc:creator>Ben L.</dc:creator><slash:comments>20</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/306412.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=306412</wfw:commentRss><description>Your choice of language. Go.</description></item><item><title>Solve this:</title><link>http://forums.thedailywtf.com/forums/thread/314012.aspx</link><pubDate>Tue, 05 Feb 2013 18:06:16 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:314012</guid><dc:creator>Nagesh</dc:creator><slash:comments>8</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/314012.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=314012</wfw:commentRss><description>&lt;p&gt;There is a fashion contest running in the city  and n number of 
panelists who are judging the contest. The Number of Judges in the 
contest can be 0 or any odd number(1,3,5,7......) ranging from 0 to 20. 
These judges are sitting in a row, holding a scorecard that displays 
scores obtained by each contestant ranging from 0 to m. There are two 
anchors standing in front of the judge who is sitting in the centre of 
the row. &lt;br /&gt;&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;Now, we want to calculate total score of a contestant given by judges&lt;/span&gt;. &lt;span style="font-weight:bold;"&gt;&lt;br /&gt;&lt;br /&gt;First of all,  the score given by center judge will be added to the total score. &lt;/span&gt;Secondly,
 the two anchors starts moving  from centre position and one goes 
towards left (i.e. toward 1st  judge) and one goes towards right (i.e. 
towards nth judge). They step towards their direction to new position 
together and they tell each other the score given by the judge.&lt;span style="font-weight:bold;"&gt;
 Now, If the scores given by judges are same then that score gets added 
to total score of that contestant. But if scores are not same then 
nothing is added to total score.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Similarly, anchors keep 
on moving to their directions and keep comparing the scores given by 
judges and adding score to the total score, if matches. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;h2 class="cc-hd2 mrgn-lft15" id="heading"&gt;Input/Output Specs&lt;/h2&gt;&lt;p&gt;   




&lt;span style="font-weight:bold;"&gt;Input Specifications :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Scores contained by individual n number of judges. Scores will be an integer array&lt;br /&gt;&lt;br style="font-weight:bold;" /&gt;&lt;span style="font-weight:bold;"&gt;Output Specifications:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Total score of contestant is the output. Return the output from the function as integer only&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;h2 class="cc-hd2 mrgn-lft15" id="heading"&gt;Examples&lt;/h2&gt;   






&lt;span style="font-weight:bold;"&gt;&lt;/span&gt; We have 5 judges and each are having scores 5,6,7,3,5&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Output : 7+5=12&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here Anchors start walking from &lt;span style="font-weight:bold;"&gt;3rd position&lt;/span&gt;. So they will take score &lt;span style="font-weight:bold;"&gt;7&lt;/span&gt; in the total. Then one anchor start moving to left and other to right. Now the scores they got is &lt;span style="font-weight:bold;"&gt;6 and 3&lt;/span&gt; but they are differnt so it will not count in total. Again they start moving, this time score given by both judges is&amp;nbsp;&lt;span style="font-weight:bold;"&gt;5 and 5&lt;/span&gt;, so it will count in total score. So the total score is &lt;span style="font-weight:bold;"&gt;7+5=12.&lt;/span&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Rewrite an O(n log n) (or better) algorithm to be O(n^2) (or worse)</title><link>http://forums.thedailywtf.com/forums/thread/304986.aspx</link><pubDate>Thu, 27 Sep 2012 19:00:30 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:304986</guid><dc:creator>Ben L.</dc:creator><slash:comments>5</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/304986.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=304986</wfw:commentRss><description>Pick your favorite algorithm
&lt;p&gt;
For example, with a linked list, clearing the list is quite simple (and O(1)):
&lt;ul&gt;&lt;li&gt;Set the pointer to the first element to null.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;
However, someone I know managed to write it in O(n^2):
&lt;ul&gt;&lt;li&gt;While the list&amp;#39;s number of elements is greater than zero.
&lt;ul&gt;&lt;li&gt;Find the value of the last element in the list.
&lt;li&gt;Remove that value from the list.
&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</description></item><item><title>Average two numbers</title><link>http://forums.thedailywtf.com/forums/thread/117552.aspx</link><pubDate>Fri, 30 Mar 2007 19:54:28 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:117552</guid><dc:creator>EvanED</dc:creator><slash:comments>73</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/117552.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=117552</wfw:commentRss><description>
&lt;p&gt;This should be simple, right?&lt;/p&gt;
&lt;p&gt;Write the body to the following function:&lt;/p&gt;
&lt;p&gt;

//Returns the arithmetic mean of the two arguments&lt;br&gt;
int average(int a, int b);

&lt;/p&gt;&lt;p&gt;Ideally, your solution should be portable, but it at least should break loudly on platforms where it won't work. (For instance, writing an asm version is acceptable. However, a solution that depends on a particular behavior of % when given negative numbers isn't (e.g. depends on -1 % 2 giving -1 instead of 1), because on compilers that implement it a different way it will silently do the wrong thing.)&lt;br&gt;&lt;/p&gt;</description></item><item><title>Lists and combinations of lists.</title><link>http://forums.thedailywtf.com/forums/thread/304983.aspx</link><pubDate>Thu, 27 Sep 2012 18:41:56 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:304983</guid><dc:creator>Nagesh</dc:creator><slash:comments>7</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/304983.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=304983</wfw:commentRss><description>Here&amp;#39;s new question in interview question bank.
&lt;br /&gt;
Given n number of lists with n number of items in each list, how will you come up with every possible combo using LINQ in C#?
&lt;br /&gt;
</description></item><item><title>Negate a number</title><link>http://forums.thedailywtf.com/forums/thread/297267.aspx</link><pubDate>Sun, 15 Jul 2012 05:01:49 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:297267</guid><dc:creator>Ben L.</dc:creator><slash:comments>21</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/297267.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=297267</wfw:commentRss><description>Negate a number (int, float, whatever) without using arithmetic operators or concatenation.</description></item><item><title>Interview challenge</title><link>http://forums.thedailywtf.com/forums/thread/266131.aspx</link><pubDate>Sat, 17 Sep 2011 20:24:09 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:266131</guid><dc:creator>Dayglo_Gerbil</dc:creator><slash:comments>42</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/266131.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=266131</wfw:commentRss><description>One I sometimes give interviewees.

There is a contiguous block of memory of some arbitrary size, it doesn&amp;#39;t matter how big it is, and in this block of memory there are again some arbitrary number of data entries which are duplicated,there is no limit to the possible number of duplicates, and there is one data entry which is not duplicated. Write a routine in any language you like which will 

A, Find the address of the one non-duplicated entry in the smallest possible number of memory accesses, or 
B, Find the address of the one non-duplicated entry in the least possible number of operations.</description></item><item><title>Text-based graphics in Javascript</title><link>http://forums.thedailywtf.com/forums/thread/298345.aspx</link><pubDate>Tue, 24 Jul 2012 17:29:12 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:298345</guid><dc:creator>curtmack</dc:creator><slash:comments>20</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/298345.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=298345</wfw:commentRss><description>&lt;p&gt;While bored one day, I randomly came up with the following nonexistant and stupid problem: What&amp;#39;s the most efficient way of drawing and updating text-based graphics in Javascript? So far, this is the best I&amp;#39;ve come up with:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Make a div called &amp;quot;screen&amp;quot; and an array of strings&lt;/li&gt;&lt;li&gt;Store each horizontal row of the screen as an element of this array&lt;/li&gt;&lt;li&gt;Update it every frame, then draw it out to the screen div using innerHTML and &amp;lt;br&amp;gt;&amp;#39;s&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;And the end result looks something like this:&lt;/p&gt;&lt;p&gt;&lt;code&gt;###########........................................................................................&lt;br /&gt;
 ########### .......................................................................................&lt;br /&gt;
 ########### ##.....................................................................................&lt;br /&gt;
 ########### ###....................................................................................&lt;br /&gt;
 ########### ####...............................................................#### ###############&lt;br /&gt;
 ########### ######.........................................................######## ###############&lt;br /&gt;
 ########### #######....................................................############ ###############&lt;br /&gt;
 ########### #########.............................................################# ###############&lt;br /&gt;
 ########### ##########........................................##################### ###############&lt;br /&gt;
 ########### ############.................................... ###################### ###############&lt;br /&gt;
 ########### #############................................... ###################### ###############&lt;br /&gt;
 ########### ############## ################################# ###################### ###############&lt;br /&gt;
 ########### ############## ################################# ###################### ###############&lt;br /&gt;
 ########### ############## ################################# ###################### ###############&lt;br /&gt;
 ########### ############## ################################# ###################### ###############&lt;br /&gt;
 ########### ############## ################################# ###################### ###############&lt;br /&gt;
 ########### ############## ################################# ###################### ###############&lt;br /&gt;
 ########### ############## ################################# ###################### ###############&lt;br /&gt;
 ########### ############## ################################# ###################### ###############&lt;br /&gt;
 ########### ############## #########################........ ###################### ###############&lt;br /&gt;
 ########### #############................................... ###################### ###############&lt;br /&gt;
 ########### ###########..................................... ###################### ###############&lt;br /&gt;
 ########### #########...........................................################### ###############&lt;br /&gt;
 ########### ########.................................................############## ###############&lt;br /&gt;
 ########### #######......................................................########## ###############&lt;br /&gt;
 ########### #####............................................................###### ###############&lt;br /&gt;
 ########### ####.................................................................## ########.......&lt;br /&gt;
 ########### ##.....................................................................................&lt;br /&gt;
 ########### #......................................................................................&lt;br /&gt;
 ########### .......................................................................................&lt;/code&gt;&lt;/p&gt;&lt;p&gt;This works surprisingly well, considering; it runs quite fast in Firefox, but it&amp;#39;s fairly slow in Chrome, and has some issues with IE8 (it draws, but I don&amp;#39;t think IE8&amp;#39;s onkeydown/up methods work; haven&amp;#39;t tried it in IE9 yet).&lt;/p&gt;&lt;p&gt;So, seeing as you guys are the world experts on all things WTF -&amp;nbsp; can &lt;i&gt;you&lt;/i&gt; come up with a better solution to this utterly pointless problem? &lt;/p&gt;</description></item><item><title>Long term Coder Challenge: WTF#</title><link>http://forums.thedailywtf.com/forums/thread/297315.aspx</link><pubDate>Mon, 16 Jul 2012 04:22:31 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:297315</guid><dc:creator>Ben L.</dc:creator><slash:comments>4</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/297315.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=297315</wfw:commentRss><description>Pronounced &amp;quot;wh tff pound&amp;quot;&lt;p&gt;
Basically, we - yes, all of us - are making a new language that encompasses every single front page WTF and whichever sidebar WTFs we find most interesting&lt;p&gt;
And the spec is written in engrish haiku.
&lt;p&gt;&lt;p&gt;&lt;em&gt;With enum like Bool&lt;br /&gt;
Equals Is Bad Syntax&lt;br /&gt;
We Use Footnote One&lt;/em&gt;
&lt;sup&gt;1&lt;/sup&gt; To determine if&lt;br /&gt;
value are same as other&lt;br /&gt;
must equals it twice</description></item><item><title>The most """"best"""" practices in ten lines</title><link>http://forums.thedailywtf.com/forums/thread/295480.aspx</link><pubDate>Mon, 25 Jun 2012 04:37:16 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:295480</guid><dc:creator>Ben L.</dc:creator><slash:comments>3</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/295480.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=295480</wfw:commentRss><description>You have 10 lines to produce the &amp;quot;best&amp;quot; self-commenting enterprisey solution to a mundane problem: namely, adding together two integers as command line arguments.

Your choice of language

Extra points for code that shouldn&amp;#39;t work but still does... Sort of</description></item><item><title>SQL Challenge for clever people.</title><link>http://forums.thedailywtf.com/forums/thread/293112.aspx</link><pubDate>Thu, 31 May 2012 16:31:57 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:293112</guid><dc:creator>Nagesh</dc:creator><slash:comments>16</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/293112.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=293112</wfw:commentRss><description>&lt;p /&gt;
I have one table look like this!
&lt;table style="border:2px solid black;"&gt;
&lt;tr&gt;
&lt;th&gt;BorrowerId&lt;/th&gt;&lt;th&gt;BorrowerName&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6785&lt;/td&gt;&lt;td&gt;Mr RICHard JohnSon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6786&lt;/td&gt;&lt;td&gt;Mrs Paula.&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt;6787&lt;/td&gt;&lt;td&gt;Mr Anand VISHwanathan&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt;6788&lt;/td&gt;&lt;td&gt;Mr Chinappa Gundaswamy&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;p /&gt;
I want to run SQL Query that will retrieve records that will not quality to ProperCase.
&lt;p /&gt;
So from above example, I need to get id of (6785 and 6787). BorrowerId is primary key.
BorrowerName can be duplicate.
&lt;p /&gt;
Assume database of your like - Sql Server / Oracle / MySql / Postgress.

&lt;p /&gt;
Any idea?
</description></item><item><title>Longest possible NOOP</title><link>http://forums.thedailywtf.com/forums/thread/240830.aspx</link><pubDate>Thu, 23 Dec 2010 03:35:51 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:240830</guid><dc:creator>Ben L.</dc:creator><slash:comments>19</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/240830.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=240830</wfw:commentRss><description>In a language of your choice.
&lt;br /&gt;&lt;br /&gt;
I&amp;#39;ll start:
&lt;pre&gt;
import sys

for i in xrange( sys.maxint ):
  sys.exit( i )
  #insert entire Linux kernel here
&lt;/pre&gt;</description></item><item><title>New game: Code-Bowling (Writing the most unmaintainable code you can!)</title><link>http://forums.thedailywtf.com/forums/thread/242228.aspx</link><pubDate>Fri, 07 Jan 2011 19:58:12 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:242228</guid><dc:creator>ircmaxell</dc:creator><slash:comments>13</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/242228.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=242228</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I&amp;#39;ve opened a question over on &lt;a href="http://stackoverflow.com/q/4627180/338665" title="Code-Bowling"&gt;StackOverflow&lt;/a&gt; similar to Code-Golf.&amp;nbsp; We&amp;#39;re calling it Code-Bowling since it&amp;#39;s pretty much the opposite of Golf in most respects.&amp;nbsp; This challenge is to write a program that randomly generates text that matches the regexp /^Good (Morning|Afternoon|Evening|Night)$/.&amp;nbsp; Other than that, there aren&amp;#39;t many rules.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Check it out and let&amp;#39;s see that bastardized code! &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Sidebar Code Practice</title><link>http://forums.thedailywtf.com/forums/thread/202487.aspx</link><pubDate>Thu, 20 Aug 2009 00:54:40 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:202487</guid><dc:creator>campkev</dc:creator><slash:comments>68</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/202487.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=202487</wfw:commentRss><description>Input: integer array of length 99.  The array is initialized with 99 unique numbers between 1 and 100 inclusive.
Output: integer that is the missing number between 1 and 100

GO.</description></item><item><title>Array Months/days/hours/minutes/seconds</title><link>http://forums.thedailywtf.com/forums/thread/266171.aspx</link><pubDate>Sun, 18 Sep 2011 15:18:10 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:266171</guid><dc:creator>mightyking</dc:creator><slash:comments>6</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/266171.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=266171</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Write a simple&amp;nbsp; code that asks the user to input x number of months/days/hours/mins/secs and then have a final array display that information in a array such tha:&lt;/p&gt;&lt;p&gt;59 is the max number of seconds, 59 is the max number of minutes, 23 is max number of hours, 29 is the max number of days (always assuming months have 30 days) and 11 is max number of months. If the case does happen to appear where there&amp;#39;s 12 months then 1 year would be displayed.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Please try to be as simple as possible. Full body code please, I need to understand this. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Pls improv this code.</title><link>http://forums.thedailywtf.com/forums/thread/267675.aspx</link><pubDate>Thu, 29 Sep 2011 14:04:31 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:267675</guid><dc:creator>Nagesh</dc:creator><slash:comments>9</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/267675.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=267675</wfw:commentRss><description>&lt;b&gt;Can you make this code shorter?&amp;nbsp;&lt;/b&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;import java.util.*;
import java.lang.*;

class Main
{
	public static void main (String[ args) throws java.lang.Exception
	{

 int n = 2;
 char[ b = new char[32];
 int pos = 31;
 int i = 0;

 while (i &amp;lt; 32)
 {
     if ((n &amp;amp; (1 &amp;lt;&amp;lt; i)) != 0)
     {
  b[pos] = &amp;#39;1&amp;#39;;
     }
     else
     {
  b[pos] = &amp;#39;0&amp;#39;;
     }
     pos--;
     i++;
 }
 System.out.println(new String(b));
	}
}
&lt;/pre&gt;</description></item><item><title>Pixel Shader QUESTION (but it may turn to be quite challenging*)</title><link>http://forums.thedailywtf.com/forums/thread/266313.aspx</link><pubDate>Mon, 19 Sep 2011 19:59:04 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:266313</guid><dc:creator>SEMI-HYBRID code</dc:creator><slash:comments>9</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/266313.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=266313</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;* if you don&amp;#39;t agree, please move this thread wherever you deem appropriate&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Background: I&amp;#39;m working on a game, it&amp;#39;s hard to call it that way as it&amp;#39;s still in phase of sketches and notes and unfinished prototypes of various tiny parts, but... whatever.&lt;/p&gt;&lt;p&gt;In writing my latest ideas&amp;amp;notes, i came to an interesting (at least to me) question:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Assume we have a 2D sprite of an &amp;quot;enemy&amp;quot;, animated and all.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Would you be able (to think of a way)&lt;/b&gt; to &lt;b&gt;write a pixel shader(s), &lt;/b&gt;which would be able to change colours, look and feel of the enemy, and look&amp;amp;feel of its movement (this one might be difficult) to represent a wide range of its &amp;quot;states&amp;quot;, such as:&lt;/p&gt;&lt;p&gt;1. Being made of stone and very cold&lt;/p&gt;&lt;p&gt;2. Being made of stone and very hot, maybe so hot that there are flames bursting around its surface&lt;/p&gt;&lt;p&gt;&amp;nbsp;3. Being made of wood that came alive&lt;/p&gt;&lt;p&gt;&lt;b&gt;etc. consider also absurd combinations like &amp;quot;being made of material that is about 60% flesh and 40% stone/fire/wood...&lt;/b&gt;&amp;nbsp; &lt;/p&gt;&lt;p&gt;&lt;b&gt;Question for you&lt;/b&gt; (though you may not be the ideal target audience**) is whether you can imagine/think of pixel shaders/way of using them(/how would the system work) to achieve this, and what such a system would be able/unable to do, and to what degree.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;** it seems like on thedailywtf there&amp;#39;s mostly business applications programmers, and such, so not many of you might know how pixel shaders work, much less at least tried to work with them...&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Disclaimer: Yes, it&amp;#39;s more of a question because i don&amp;#39;t know the answer and need someone better at this stuff to at least hint me.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Edit: Special way of editing/preprocessing/creating the sprites/graphics permitted, but not having to do it would be preffered.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;(e.g. you can have a system where various colors in sprite would represent various materials and how they react with various properties, and the &amp;quot;real&amp;quot; graphics of the material will be created by the pixel shader itself, but i would prefer using 2D sprites where just everything looks as it&amp;#39;s supposed to in &amp;quot;default&amp;quot; state, and having the pixel shaders alter this graphics in the most simple, but as flexible and most believably looking&amp;nbsp; as possible - i&amp;#39;m in no way talking about 100% &amp;quot;realism&amp;quot;, i&amp;#39;m looking for something that will &amp;quot;feel right&amp;quot; in the context of 2D.)&lt;/p&gt;</description></item><item><title>fetching objects form some space</title><link>http://forums.thedailywtf.com/forums/thread/248944.aspx</link><pubDate>Wed, 02 Mar 2011 16:08:02 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:248944</guid><dc:creator>Luke</dc:creator><slash:comments>6</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/248944.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=248944</wfw:commentRss><description>&lt;p&gt;Supose you have a distributed system based on something like java spaces. You can use space.read(template), even something like readAll(template) or readMultiple(template, count) and you can register a listener with the template then get nottified of new messages are written by someone else in space. You already have the space created and some objects matching the template already there. Now you connect a client that wants to read all the objects already there and then be nottifed of new ones apearing. How do you do that to ensure you don&amp;#39;t miss any and you don&amp;#39;t read one twice (via read and notification) if you can&amp;#39;t alter the space and is not possible to keep localy all you read? Supose you can have same payload in two objects, case in which you need them twice. Issue is that new objects can appear while you initialy iterate the existing ones them and you have to do that because the listener only notiffy you for new ones, not for the existing ones. &lt;/p&gt;</description></item><item><title>The Disgruntled Bomb</title><link>http://forums.thedailywtf.com/forums/thread/250153.aspx</link><pubDate>Tue, 15 Mar 2011 13:13:05 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:250153</guid><dc:creator>dhromed</dc:creator><slash:comments>0</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/250153.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=250153</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;It amused me, so, repost, and do your worst.&lt;/p&gt;&lt;p&gt;&lt;a href="http://thedailywtf.com/Articles/The-Disgruntled-Bomb.aspx"&gt;&amp;nbsp;http://thedailywtf.com/Articles/The-Disgruntled-Bomb.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Electoral College</title><link>http://forums.thedailywtf.com/forums/thread/75403.aspx</link><pubDate>Thu, 01 Jun 2006 07:13:09 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:75403</guid><dc:creator>tster</dc:creator><slash:comments>18</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/75403.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=75403</wfw:commentRss><description>&amp;nbsp;&amp;nbsp;&amp;nbsp; back in 2004 there was some hubbub about the possibility of a tie in the electoral college.&amp;nbsp; writing a program to check if a tie is possible is a fun little excercise (and the computation time is practically 0)... however, it proves deceptively more complicated to figure out how many ways there are of getting a tie.&amp;nbsp; using this list of states:&lt;br&gt;&lt;br&gt;&lt;div class="e"&gt;
&lt;div class="c"&gt;&lt;a class="b"&gt;-&lt;/a&gt; &lt;span class="m"&gt;&amp;lt;StateList&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Alabama&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;9&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Alaska&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;3&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Arizona&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;10&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Arkansas&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;6&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;California&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;55&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Colorado&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;9&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Connecticut&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;7&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Delaware&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;3&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;District of Columbia&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;3&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Florida&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;27&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Georgia&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;15&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Hawaii&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;4&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Idaho&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;4&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Illinois&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;21&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Indiana&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;11&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Iowa&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;7&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Kansas&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;6&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Kentucky&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;8&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Louisiana&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;9&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Maine&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;4&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Maryland&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;10&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Massachusetts&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;12&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Michigan&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;17&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Minnesota&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;10&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Mississippi&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;6&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Missouri&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;11&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Montana&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;3&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Nebraska&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;5&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Nevada&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;5&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;New Hampshire&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;4&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;New Jersey&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;15&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;New Mexico&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;5&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;New York&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;31&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;North Carolina&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;15&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;North Dakota&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;3&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Ohio&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;20&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Oklahoma&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;7&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Oregon&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;7&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Pennsylvania&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;21&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Rhode Island&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;4&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;South Carolina&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;8&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;South Dakota&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;3&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Tennessee&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;11&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Texas&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;34&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Utah&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;5&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Vermont&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;3&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Virginia&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;13&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Washington&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;11&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;West Virginia&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;5&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Wisconsin&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;10&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;State&amp;gt;&amp;lt;Name&amp;gt;Wyoming&amp;lt;/Name&amp;gt;&amp;lt;Votes&amp;gt;3&amp;lt;/Votes&amp;gt;&amp;lt;/State&amp;gt;&lt;br&gt;&amp;lt;/StateList&amp;gt;&lt;br&gt;&lt;br&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;tell me how many ways there are to get a tie.&amp;nbsp;&amp;nbsp; I currently have a program running that will solve it, however it is a 2 minute modification from a program that generated a list of every possible combination of states to get a tie so my algorithm is probably not optimal.&amp;nbsp;&amp;nbsp; I'll post my answer later (after I wake up) and if I get around to modifying the code I'll post how long it takes my computer to find the answer.&lt;br&gt;</description></item><item><title>Post the most elegant solution in your favorite language</title><link>http://forums.thedailywtf.com/forums/thread/158742.aspx</link><pubDate>Wed, 09 Apr 2008 18:56:37 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:158742</guid><dc:creator>russ0519</dc:creator><slash:comments>86</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/158742.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=158742</wfw:commentRss><description>&lt;p&gt;Ok, so I&amp;#39;m not sure if I&amp;#39;m doing it right.&amp;nbsp; Post the most elegant solution to the following problem.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;You have a table named users.&amp;nbsp; it has four fields, userId, userName, firstName, lastName.&lt;/p&gt;&lt;p&gt;Generate an html table with the contents of the table. &amp;nbsp;&lt;/p&gt;&lt;p&gt;I will start with an example in ColdFusion:&lt;/p&gt;&amp;lt;cfquery name=&amp;quot;myQuery&amp;quot; datasource=&amp;quot;myDSN&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;select userId, userName, firstName, lastName&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;from users&lt;br /&gt;&amp;lt;/cfquery&amp;gt;&lt;br /&gt;&amp;lt;table&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;tr&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;th&amp;gt;User ID&amp;lt;/th&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;th&amp;gt;UserName&amp;lt;/th&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;th&amp;gt;First Name&amp;lt;/th&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;th&amp;gt;Last Name&amp;lt;/th&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cfoutput query=&amp;quot;myQuery&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;td&amp;gt;#userId#&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;td&amp;gt;#username#&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;td&amp;gt;#firstName#&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;td&amp;gt;#lastName#&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/cfoutput&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;</description></item><item><title>Create a binary Tree from given Inorder and Preorder.</title><link>http://forums.thedailywtf.com/forums/thread/149159.aspx</link><pubDate>Sat, 16 Feb 2008 19:02:49 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:149159</guid><dc:creator>diffuser78</dc:creator><slash:comments>19</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/149159.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=149159</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;The prototype is&lt;br /&gt;&lt;br /&gt;btreenode* create_binary_tree(char *inorder, char *preorder, int length)&lt;br /&gt;
&lt;br /&gt;where length is the length of the string when contents of binary tree are written in sequential fashion.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;btreenode is as follows&lt;br /&gt;&lt;br /&gt;typedef struct btreenode{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; struct btreenore *left;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; char data;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; struct btreenode *right;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Compare your recursive and non-recursive implementations. &amp;nbsp;&lt;/p&gt;</description></item><item><title>Good algorithm wanted</title><link>http://forums.thedailywtf.com/forums/thread/209921.aspx</link><pubDate>Fri, 11 Dec 2009 07:36:55 GMT</pubDate><guid isPermaLink="false">24b8a869-dfac-465a-8bea-5fc51108d524:209921</guid><dc:creator>Luke</dc:creator><slash:comments>13</slash:comments><comments>http://forums.thedailywtf.com/forums/thread/209921.aspx</comments><wfw:commentRss>http://forums.thedailywtf.com/forums/commentrss.aspx?SectionID=20&amp;PostID=209921</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;This is the problem:&lt;/p&gt;&lt;p&gt;We have 2 groups of numbers groupA and groupB. For each element in groupA you have to find one or more elements in groupB so the sum of the chosen elements in groupB equals the element from groupA. (Not posible to match one element from B with multiple elements from A, just one from A with one or more from B) We know that a solution always exist so you consume all elements in both groups.&lt;/p&gt;&lt;p&gt;I don&amp;#39;t necesarly need a solution, I don&amp;#39;t know if it exists. In fact I&amp;#39;m also looking for a good explanation that ther&amp;#39;s no nice solution except using backtraking (twice). In our real problem we have more data that helps us in the matching process but in the extreme case if those aditional informations are all equal in value we end up with the described problem. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Thanks &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>