<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-4268903649676626374.post8263733212758923883..comments</id><updated>2010-10-26T23:02:31.724+02:00</updated><category term='Prague Seedcamp OpenCoffee'/><category term='certificate'/><category term='Tasks'/><category term='hack passwd'/><category term='SXSWi USA trip'/><title type='text'>Comments on Codility: The Power of Good Design</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.codility.com/feeds/8263733212758923883/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4268903649676626374/8263733212758923883/comments/default'/><link rel='alternate' type='text/html' href='http://blog.codility.com/2009/10/power-of-good-design-one-of-my-favorite.html'/><author><name>Codility</name><uri>http://www.blogger.com/profile/09066412611252156638</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4268903649676626374.post-979745572186916641</id><published>2010-10-26T23:02:31.724+02:00</published><updated>2010-10-26T23:02:31.724+02:00</updated><title type='text'>Not bad, but anything beyond the original solution...</title><content type='html'>Not bad, but anything beyond the original solution introduces extra constant time slowdown. Now if the interview candidate could sufficiently argue why that is irrelevant (compiler optimizations, or optimize 80-20 rule, etc) then that would be pretty impressive.&lt;br /&gt;&lt;br /&gt;Alexandru, using the &amp;quot;compiler&amp;#39;s internal stack&amp;quot; is equivalent to O(n) memory usage where n is the # of nodes in the linked list, so it fails to satisfy the problem constraint of O(1) memory usage.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4268903649676626374/8263733212758923883/comments/default/979745572186916641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4268903649676626374/8263733212758923883/comments/default/979745572186916641'/><link rel='alternate' type='text/html' href='http://blog.codility.com/2009/10/power-of-good-design-one-of-my-favorite.html?showComment=1288126951724#c979745572186916641' title=''/><author><name>Smirnov</name><uri>http://openid.aol.com/SmirnovX</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.codility.com/2009/10/power-of-good-design-one-of-my-favorite.html' ref='tag:blogger.com,1999:blog-4268903649676626374.post-8263733212758923883' source='http://www.blogger.com/feeds/4268903649676626374/posts/default/8263733212758923883' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1622050479'/></entry><entry><id>tag:blogger.com,1999:blog-4268903649676626374.post-6370855851653703736</id><published>2009-10-14T13:04:19.559+02:00</published><updated>2009-10-14T13:04:19.559+02:00</updated><title type='text'>What about recursion? Isn&amp;#39;t that easier to imp...</title><content type='html'>What about recursion? Isn&amp;#39;t that easier to implement and more elegant?&lt;br /&gt;&lt;br /&gt;Here&amp;#39;s a suggestion:&lt;br /&gt;&lt;br /&gt;ListNode invertList(ListNode currN, ListNode succN) {&lt;br /&gt; ListNode startN = null;&lt;br /&gt; &lt;br /&gt; if( succN.next != null ) startN = invertList(succN, succN.next);&lt;br /&gt; else startN = succN;&lt;br /&gt; succN.next = currN;&lt;br /&gt; &lt;br /&gt; return startN;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;It should be called as&lt;br /&gt;newFirstNode = invertList( null, firstNode );&lt;br /&gt;&lt;br /&gt;It&amp;#39;s basically the same principle that you described but it&amp;#39;s using the compiler&amp;#39;s internal stack. Therefore we work on the initial list (and there&amp;#39;s no need to create a new list/stack). This means less memory to use.&lt;br /&gt;&lt;br /&gt;What do you think?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4268903649676626374/8263733212758923883/comments/default/6370855851653703736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4268903649676626374/8263733212758923883/comments/default/6370855851653703736'/><link rel='alternate' type='text/html' href='http://blog.codility.com/2009/10/power-of-good-design-one-of-my-favorite.html?showComment=1255518259559#c6370855851653703736' title=''/><author><name>Alexandru</name><uri>http://www.blogger.com/profile/09534466269309520040</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.codility.com/2009/10/power-of-good-design-one-of-my-favorite.html' ref='tag:blogger.com,1999:blog-4268903649676626374.post-8263733212758923883' source='http://www.blogger.com/feeds/4268903649676626374/posts/default/8263733212758923883' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1823393960'/></entry></feed>
