I read too and it doesn't make any sense for me. I understand that this is a geometric distribution where if P(X)=p so E(X)=1/p. So, if you have 2 numbers unsorted and Goro hits the table, there is 0.5% chance to stay in the same position and 0.5% chance to swap positions. But, if you have 3 unsorted elements, there are 6 different permutations, so, P(X)=1/6 and the E(X)=6. My solution is hold 1 number, swap the other 2; hold the sorted element and swap the other 2 remaining, so 2 + 2 = 4 hits
3 1 2 1 3 2 1 2 3 But this doesn't seem to be the correct answer. The developers solutions say that for 3 unsorted numbers needs only 3 hits. Anyone knows how to explain that? Regards, Ricardo On May 7, 8:24 pm, SwiftCoder <[email protected]> wrote: > I looked at some of the solutions, as per that umber of hits are same > as the count of numbers which are not at their correct sorted > position. Is that so? -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
