<?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: Google Interview Question: Product of other Elements in an Array in O(n)</title>
	<atom:link href="http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/</link>
	<description>Functional programming on .Net</description>
	<lastBuildDate>Tue, 23 Feb 2010 22:18:36 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: claudio</title>
		<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/comment-page-1/#comment-5306</link>
		<dc:creator>claudio</dc:creator>
		<pubDate>Thu, 25 Jun 2009 07:01:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/?p=35#comment-5306</guid>
		<description>@jhon: your interview reports are very interesting, thanks!</description>
		<content:encoded><![CDATA[<p>@jhon: your interview reports are very interesting, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jhon</title>
		<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/comment-page-1/#comment-5303</link>
		<dc:creator>jhon</dc:creator>
		<pubDate>Thu, 25 Jun 2009 06:30:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/?p=35#comment-5303</guid>
		<description>Hi,
I interviewed for the associate product manager position at google, you can read it up here

http://ferozeh.com/Interviews/Google/google.php</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I interviewed for the associate product manager position at google, you can read it up here</p>
<p><a href="http://ferozeh.com/Interviews/Google/google.php" rel="nofollow">http://ferozeh.com/Interviews/Google/google.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Problem with an interesting little problem &#171; Antimatroid&#8217;s Weblog</title>
		<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/comment-page-1/#comment-588</link>
		<dc:creator>Problem with an interesting little problem &#171; Antimatroid&#8217;s Weblog</dc:creator>
		<pubDate>Fri, 08 Aug 2008 01:18:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/?p=35#comment-588</guid>
		<description>[...] fsharp.it posted the above simple Google interview question on their site a few weeks ago and subsequently the problem was referenced by OJ&#8217;s rants and later posted to the programming subreddit on reddit.com. Like everyone else, I sat down and wrote some quick code to solve the problem. After looking a the solution, it seemed to me that this was a rather poorly conceived problem- if not contrived at heart. It doen&#8217;t ring to the tune of scalability, performance and quality that one thinks of when the word Google is thrown into the mix. [...]</description>
		<content:encoded><![CDATA[<p>[...] fsharp.it posted the above simple Google interview question on their site a few weeks ago and subsequently the problem was referenced by OJ&#8217;s rants and later posted to the programming subreddit on reddit.com. Like everyone else, I sat down and wrote some quick code to solve the problem. After looking a the solution, it seemed to me that this was a rather poorly conceived problem- if not contrived at heart. It doen&#8217;t ring to the tune of scalability, performance and quality that one thinks of when the word Google is thrown into the mix. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: claudio</title>
		<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/comment-page-1/#comment-530</link>
		<dc:creator>claudio</dc:creator>
		<pubDate>Fri, 11 Jul 2008 15:11:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/?p=35#comment-530</guid>
		<description>Hi Pavel, 
we should check how the concatenation operator @ is implemented, I&#039;m not sure its complexity is O(n).
BTW, your solution is very good!</description>
		<content:encoded><![CDATA[<p>Hi Pavel,<br />
we should check how the concatenation operator @ is implemented, I&#8217;m not sure its complexity is O(n).<br />
BTW, your solution is very good!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pavel</title>
		<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/comment-page-1/#comment-529</link>
		<dc:creator>Pavel</dc:creator>
		<pubDate>Fri, 11 Jul 2008 14:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/?p=35#comment-529</guid>
		<description>Hi claudio,

Perhaps I&#039;m wrong, but, IMHO, your solution has O(n^2)  or O(n*log(n)) complexity  because you use @ operator into recursive function. 
@ operator has O(n) complexity itself.

BTW my solution http://fsharpere.blogspot.com/2008/07/google-interview-question.html</description>
		<content:encoded><![CDATA[<p>Hi claudio,</p>
<p>Perhaps I&#8217;m wrong, but, IMHO, your solution has O(n^2)  or O(n*log(n)) complexity  because you use @ operator into recursive function.<br />
@ operator has O(n) complexity itself.</p>
<p>BTW my solution <a href="http://fsharpere.blogspot.com/2008/07/google-interview-question.html" rel="nofollow">http://fsharpere.blogspot.com/2008/07/google-interview-question.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: claudio</title>
		<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/comment-page-1/#comment-449</link>
		<dc:creator>claudio</dc:creator>
		<pubDate>Thu, 26 Jun 2008 22:47:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/?p=35#comment-449</guid>
		<description>Only 4 lines instead of my 22, that&#039;s a great solution!</description>
		<content:encoded><![CDATA[<p>Only 4 lines instead of my 22, that&#8217;s a great solution!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Harrop</title>
		<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/comment-page-1/#comment-448</link>
		<dc:creator>Jon Harrop</dc:creator>
		<pubDate>Thu, 26 Jun 2008 22:37:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/?p=35#comment-448</guid>
		<description>As a dynamic programming problem you can solve this for small arrays using naive recursion wrapped in a memoize combinator:

[fsharp]
let product (a : _ array) =
    let rec f = memoize(fun (i, di) -&gt;
        if i = a.Length then 1 else f(i+di, di) * a.[i])
    Array.init a.Length (fun i -&gt; f(i-1, -1) * f(i+1, 1))
[/fsharp]</description>
		<content:encoded><![CDATA[<p>As a dynamic programming problem you can solve this for small arrays using naive recursion wrapped in a memoize combinator:</p>
<pre class="brush: fsharp">
let product (a : _ array) =
    let rec f = memoize(fun (i, di) -&amp;gt;
        if i = a.Length then 1 else f(i+di, di) * a.[i])
    Array.init a.Length (fun i -&amp;gt; f(i-1, -1) * f(i+1, 1))
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: OJ&#8217;s rants &#187; An Interesting Little Problem</title>
		<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/comment-page-1/#comment-413</link>
		<dc:creator>OJ&#8217;s rants &#187; An Interesting Little Problem</dc:creator>
		<pubDate>Sat, 14 Jun 2008 10:40:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/?p=35#comment-413</guid>
		<description>[...] post was inspired by a recent interview question that was posted over at fsharp.it. It&#8217;s one of those neat little questions which looks really simple on the surface but is [...]</description>
		<content:encoded><![CDATA[<p>[...] post was inspired by a recent interview question that was posted over at fsharp.it. It&#8217;s one of those neat little questions which looks really simple on the surface but is [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: claudio</title>
		<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/comment-page-1/#comment-410</link>
		<dc:creator>claudio</dc:creator>
		<pubDate>Tue, 10 Jun 2008 18:43:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/?p=35#comment-410</guid>
		<description>I&#039;m glad to hear that, in my opinion a good mix of problem solving and coding questions is the best way to interview people for software development positions.</description>
		<content:encoded><![CDATA[<p>I&#8217;m glad to hear that, in my opinion a good mix of problem solving and coding questions is the best way to interview people for software development positions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: a.</title>
		<link>http://www.fsharp.it/2008/06/10/google-interview-question-product-of-other-elements-in-an-array-in-on/comment-page-1/#comment-409</link>
		<dc:creator>a.</dc:creator>
		<pubDate>Tue, 10 Jun 2008 18:37:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/?p=35#comment-409</guid>
		<description>Microsoft focus on the same thing, they have problem solving and coding questions. But they start with the logical ones on phone interviews.</description>
		<content:encoded><![CDATA[<p>Microsoft focus on the same thing, they have problem solving and coding questions. But they start with the logical ones on phone interviews.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
