<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ebeworld's Weblog &#187; TopCoder</title>
	<atom:link href="http://ebeworld.wordpress.com/category/topcoder/feed/" rel="self" type="application/rss+xml" />
	<link>http://ebeworld.wordpress.com</link>
	<description>Trying to create</description>
	<lastBuildDate>Wed, 09 Dec 2009 19:33:44 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='ebeworld.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/cbd4023a12f78275f1676e6f81eb8a20?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Ebeworld's Weblog &#187; TopCoder</title>
		<link>http://ebeworld.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ebeworld.wordpress.com/osd.xml" title="Ebeworld&#8217;s Weblog" />
		<item>
		<title>Benefit of using Swing over AWT</title>
		<link>http://ebeworld.wordpress.com/2008/10/14/benefit-of-using-swing-over-awt/</link>
		<comments>http://ebeworld.wordpress.com/2008/10/14/benefit-of-using-swing-over-awt/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 08:53:09 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[TopCoder]]></category>
		<category><![CDATA[Interview Questions]]></category>
		<category><![CDATA[Swing]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/?p=23</guid>
		<description><![CDATA[What is the difference between AWT and Swing? LF DC
Â Swing provides a richer set of components than AWT. They are 100% Java-based. There are a few otherÂ advantages to Swing over AWT:
• Swing provides both additional components like JTable, JTree etc and added functionality to AWT-replacementÂ components.
• Swing components can change their appearance based [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=23&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>What is the difference between AWT and Swing? LF DC</p>
<p>Â Swing provides a richer set of components than AWT. They are 100% Java-based. There are a few otherÂ advantages to Swing over AWT:</p>
<p>• Swing provides both additional components like JTable, JTree etc and added functionality to AWT-replacementÂ components.</p>
<p>• Swing components can change their appearance based on the current “look and feel” library that’s being used.</p>
<p>• Swing components follow the Model-View-Controller (MVC) paradigm, and thus can provide a much more</p>
<p>flexible UI.</p>
<p>• Swing provides “extras” for components, such as: icons on many components, decorative borders for</p>
<p>components, tool tips for components etc.</p>
<p>• Swing components are lightweight (less resource intensive than AWT).</p>
<p>Swing provides built-in double buffering (which means an off-screen buffer [image] is used during drawing</p>
<p>and then the resulting bits are copied onto the screen. The resulting image is smoother, less flicker and quickerÂ than drawing directly on the screen).</p>
<p>• Swing provides paint debugging support for when you build your own component i.e.-slow motion rendering.</p>
<p>Swing also has a few disadvantages:</p>
<p>• If you’re not very careful when programming, it can be slower than AWT (all components are drawn).</p>
<p>• Swing components that look like native components might not behave exactly like native components.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=23&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2008/10/14/benefit-of-using-swing-over-awt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>TopCoder 250 point problem</title>
		<link>http://ebeworld.wordpress.com/2008/10/13/topcoder-250-point-problem/</link>
		<comments>http://ebeworld.wordpress.com/2008/10/13/topcoder-250-point-problem/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 05:51:38 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[TopCoder]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/?p=11</guid>
		<description><![CDATA[



Problem Statement



    
Pig Latin is a simple way of encoding words. We have invented a            competitor called &#8220;Vowel Latin&#8221;. It just changes the order of the            letters in a word by moving all the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=11&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><table border="0">
<tbody>
<tr>
<td colspan="2">
<h3>Problem Statement</h3>
</td>
</tr>
<tr>
<td>    </td>
<td>Pig Latin is a simple way of encoding words. We have invented a            competitor called &#8220;Vowel Latin&#8221;. It just changes the order of the            letters in a word by moving all the vowels to the end, keeping them            in the same order as they appeared in the original word.Vowels are defined to be the letters &#8216;a&#8217;, &#8216;e&#8217;, &#8216;i&#8217;, &#8216;o&#8217;, and &#8216;u&#8217;              (in either uppercase or lowercase). The reordering of the letters              in a word does not change their case. So the Vowel Latin version              of &#8220;AmplifierX&#8221; would be &#8220;mplfrXAiie&#8221; </p>
<p>Create a class VowelLatin that contains a method translate that is              given a String <strong>word</strong> and that returns the Vowel Latin              version of <strong>word</strong>.</td>
</tr>
<tr>
<td colspan="2">
<h3>Definition</h3>
</td>
</tr>
<tr>
<td>    </td>
<td>
<table border="0">
<tbody>
<tr>
<td>Class:</td>
<td>VowelLatin</td>
</tr>
<tr>
<td>Method:</td>
<td>translate</td>
</tr>
<tr>
<td>Parameters:</td>
<td>String</td>
</tr>
<tr>
<td>Returns:</td>
<td>String</td>
</tr>
<tr>
<td>Method signature:</td>
<td>String translate(String word)</td>
</tr>
<tr>
<td colspan="2">(be sure your method is public)</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>    </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td colspan="2">
<h3>Constraints</h3>
</td>
</tr>
<tr>
<td align="center" valign="top">-</td>
<td><strong>word</strong> contains between 1 and 50 characters, inclusive.</td>
</tr>
<tr>
<td align="center" valign="top">-</td>
<td>Each character in <strong>word</strong> is a letter (&#8216;A&#8217;-'Z&#8217;, &#8216;a&#8217;-'z&#8217;).</td>
</tr>
<tr>
<td colspan="2">
<h3>Examples</h3>
</td>
</tr>
<tr>
<td align="center">0)</td>
<td> </td>
</tr>
<tr>
<td>    </td>
<td>
<table border="0">
<tbody>
<tr>
<td>
<table border="0">
<tbody>
<tr>
<td>
<pre>"XYz"</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<pre>Returns: "XYz"</pre>
</td>
</tr>
<tr>
<td>
<table border="0">
<tbody>
<tr>
<td colspan="2">The word contains no vowels so it is unchanged by                        translating to Vowel Latin.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="center">1)</td>
<td> </td>
</tr>
<tr>
<td>    </td>
<td>
<table border="0">
<tbody>
<tr>
<td>
<table border="0">
<tbody>
<tr>
<td>
<pre>"application"</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<pre>Returns: "pplctnaiaio"</pre>
</td>
</tr>
<tr>
<td>
<table border="0">
<tbody>
<tr>
<td colspan="2">The 5 vowels in this word are all moved to the end of                        the word.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="center">2)</td>
<td> </td>
</tr>
<tr>
<td>    </td>
<td>
<table border="0">
<tbody>
<tr>
<td>
<table border="0">
<tbody>
<tr>
<td>
<pre>"qwcvb"</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<pre>Returns: "qwcvb"</pre>
</td>
</tr>
<tr>
<td> </td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="center">3)</td>
<td> </td>
</tr>
<tr>
<td>    </td>
<td>
<table border="0">
<tbody>
<tr>
<td>
<table border="0">
<tbody>
<tr>
<td>
<pre>"aeioOa"</pre>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<pre>Returns: "aeioOa"</pre>
</td>
</tr>
<tr>
<td> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>import java.util.*;</p>
<p> </p>
<p>public class VowelLatin {</p>
<p><span> </span>public String translate(String word){</p>
<p><span> </span>char[] chars=word.toCharArray();</p>
<p><span> </span>String vowels=&#8221;aeiouAEIOU&#8221;;</p>
<p><span> </span>StringBuilder end=new StringBuilder();</p>
<p><span> </span>StringBuilder beg=new StringBuilder();</p>
<p><span> </span>for(char c:chars){</p>
<p><span> </span></p>
<p><span> </span>if(vowels.indexOf(c)&gt;-1){</p>
<p><span> </span>end.append(c);</p>
<p><span> </span>}else{</p>
<p><span> </span>beg.append(c);</p>
<p><span> </span>}</p>
<p><span> </span>}</p>
<p><span> </span>beg.append(end.toString());</p>
<p><span> </span>return beg.toString();</p>
<p><span> </span>}</p>
<p>}</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=11&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2008/10/13/topcoder-250-point-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
		<item>
		<title>TopCoder 500 point problem</title>
		<link>http://ebeworld.wordpress.com/2008/10/13/topcoder-500-point-problem/</link>
		<comments>http://ebeworld.wordpress.com/2008/10/13/topcoder-500-point-problem/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 05:41:51 +0000</pubDate>
		<dc:creator>ebeworld</dc:creator>
				<category><![CDATA[TopCoder]]></category>

		<guid isPermaLink="false">http://ebeworld.wordpress.com/2008/10/13/topcoder-500-point-problem/</guid>
		<description><![CDATA[Problem Statement
I want a list of BioServices that are associated with each KindOfInput (such as &#8220;gene&#8221;, &#8220;DNAFragment&#8221;, &#8220;genome&#8221;, etc.). What is available from my service provider is a list of strings, each containing the name of a service followed by all the KindsOfInput it requires.
Given a String[] services, return a String[] in which each element [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=10&subd=ebeworld&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Problem Statement</p>
<p>I want a list of BioServices that are associated with each KindOfInput (such as &#8220;gene&#8221;, &#8220;DNAFragment&#8221;, &#8220;genome&#8221;, etc.). What is available from my service provider is a list of strings, each containing the name of a service followed by all the KindsOfInput it requires.<br />
Given a String[] services, return a String[] in which each element contains a KindOfInput followed by the names of all the services that use that kind of input.<br />
Each KindOfInput should appear exactly once in the return. Within each element of the return, the service names should be in alphabetical order, and should be separated by the 2 characters &#8220;, &#8221; (comma space). The KindOfInput should be separated from the first service name by the 5 characters &#8221; ==&gt; &#8221; (space eq eq gt space). The returned list should be in alphabetical order.<br />
Note that all names are case-sensitive, and that &#8220;alphabetical order&#8221; refers to the ASCII ordering, where, for example, &#8216;Z&#8217; precedes &#8216;a&#8217;.<br />
Definition</p>
<p>Class:<br />
ServiceNames<br />
Method:<br />
makeList<br />
Parameters:<br />
String[]<br />
Returns:<br />
String[]<br />
Method signature:<br />
String[] makeList(String[] services)<br />
(be sure your method is public)
    </p>
<p>Constraints<br />
-<br />
services will contain between 1 and 50 elements, inclusive.<br />
-<br />
Each element of services will contain between 1 and 50 characters, inclusive.<br />
-<br />
Each element of services will contain tokens separated by a single space (&#8216; &#8216;).<br />
-<br />
Each token will consist of 1 or more letters (&#8216;A&#8217;-'Z&#8217; or &#8216;a&#8217;-'z&#8217;).<br />
-<br />
The first tokens of the elements in services will be distinct.<br />
-<br />
Within each element of services the KindsOfInput will be distinct.<br />
Examples<br />
0)</p>
<p>
{&#8220;BLAST Genome Annotation Sensitivity&#8221;,&#8221;PING&#8221;,&#8221;X Annotation&#8221;}<br />
Returns: {&#8220;Annotation ==&gt; BLAST, X&#8221;, &#8220;Genome ==&gt; BLAST&#8221;, &#8220;Sensitivity ==&gt; BLAST&#8221; }</p>
<p>1)</p>
<p>
{&#8220;PING&#8221;}<br />
Returns: { }<br />
There are no KindsOfInput so the return has 0 elements.<br />
2)</p>
<p>
{&#8220;BLAST Genome annotation Sensitivity&#8221;,&#8221;PING&#8221;,&#8221;X Annotation&#8221;,&#8221;Apple X ample&#8221;}<br />
Returns:<br />
{&#8220;Annotation ==&gt; X&#8221;,<br />
 &#8220;Genome ==&gt; BLAST&#8221;,<br />
 &#8220;Sensitivity ==&gt; BLAST&#8221;,<br />
 &#8220;X ==&gt; Apple&#8221;,<br />
 &#8220;ample ==&gt; Apple&#8221;,<br />
 &#8220;annotation ==&gt; BLAST&#8221; }<br />
annotation and Annotation are distinct kinds of input. annotation comes later alphabetically than any name that starts with an uppercase letter.</p>
<p>Solution:</p>
<p>import java.util.*;</p>
<p>public class ServiceNames {<br />
 public String[] makeList(String[] services){<br />
  HashMap&lt;String,HashSet&lt;String&gt;&gt; map=new HashMap&lt;String,HashSet&lt;String&gt;&gt;();<br />
  for(String service:services){<br />
   String[] comp=service.split(&#8221; &#8220;);<br />
   if(comp.length&lt;2) continue;<br />
   HashSet&lt;String&gt; list=null;<br />
   for(int i=1;i&lt;comp.length;i++){<br />
    if(!map.containsKey(comp[i])){<br />
     map.put(comp[i], new HashSet&lt;String&gt;());<br />
    }<br />
    list=map.get(comp[i]);<br />
    list.add(comp[0]);<br />
   }<br />
  }<br />
  ArrayList&lt;String&gt; ret=new ArrayList&lt;String&gt;();<br />
  StringBuilder result=new StringBuilder();<br />
  String[] keys=map.keySet().toArray(new String[0]);<br />
  for(String key:keys){<br />
   result=new StringBuilder(key+&#8221; ==&gt; &#8220;);<br />
   HashSet&lt;String&gt; vals=map.get(key);<br />
   String[] svals=vals.toArray(new String[0]);<br />
   if(svals.length==0) continue;<br />
   Arrays.sort(svals);<br />
   result.append(svals[0]);<br />
   for(int i=1;i&lt;svals.length;i++){<br />
    result.append(&#8220;, &#8220;+svals[i]);<br />
   }<br />
   ret.add(result.toString());<br />
  }<br />
  String[] sret=ret.toArray(new String[0]);<br />
  Arrays.sort(sret);<br />
  return sret;</p>
<p> }<br />
}</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ebeworld.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ebeworld.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ebeworld.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ebeworld.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ebeworld.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ebeworld.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ebeworld.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ebeworld.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ebeworld.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ebeworld.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ebeworld.wordpress.com&blog=5157598&post=10&subd=ebeworld&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ebeworld.wordpress.com/2008/10/13/topcoder-500-point-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e5ebaca1d1c2b06cc18b8d977bb1c37d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ebeworld</media:title>
		</media:content>
	</item>
	</channel>
</rss>