David Naseby wrote: >> From: George Ogata [mailto:g_ogata / optushome.com.au] >> one_in_each([1,2,3,4,5], >> [[1,2,3,4,5],[1,2,3,4,5],[1,2,0,0,0],[1,2,0,0,0],[1,2,0,0,0]]) >> >> To correct this, his worst-case complexity must increase >> dramatically, I think. > > Not too dramatically, and incidentally, failing cases are sped up a lot in > this version.. although it slows down the passing cases more. > Try again: one_in_each([1,2,3,4],[[1,2,3,4],[2,3,4],[2,3,4],[2,3,4]]) should be true. This bit looks strange to me, though: if (arr_of_arr.length - (arr_of_arr - arr).length) > arr.length ^^^^^^^^^^^^^^^^ None of the elements of arr can be in arr_of_arr since they're of different types. Thus your use of "arr_of_arr - arr" is the same as "arr_of_arr.uniq", I think.