3 ms·
Most people didn't think to check that the array had at least two elements, but more did that than managed to correctly loop through it. I'm not sure what your
by tempestn 12y ago
Most people didn't think to check that the array had at least two elements, but more did that than managed to correctly loop through it.
I'm not sure what your PS is referring to. Which posted solutions, and what article?
- Retric 12y agolink at the top... "life the universe and technical interviews" http://diegobasch.com/life-the-universe-and-technical-interviews http://diegobasch.com/life-the-universe-and-technical-interv.... Every solution has a loop 1 to 1000000 which is N but then they check every digit which is a log N making them N log N solutions. But there are Log N solutions that avoid checking every possibility. Ex: s dup if 10 /mod recurse + then ; : f 0 1000000 0 do i s 42 = if 1 + then loop ;