News for hackers. Stuff that matters.
Re:Can you solve it? The Greplin programming challenge by zmitri on Friday October 08, 2010 @04:03PM (#1773133)
The last question isn't that difficult if you brute force it and have loads of memory. I tried to do it in python using itertools on my work thinclient and got a memoryerror. If you however break up your combinations.. you're good to go!

Fun, made my day. Good idea greplin dudes!

Re:Can you solve it? The Greplin programming challenge by tbrownaw on Friday October 08, 2010 @09:19PM (#1774062)
Not sure what you'd need the loads of memory for?

    int[] nums = {...}
    for i = 1 to (2^length(nums) - 1)
        int[] possibility = { nums[x] where (2^x bitand i) > 0 }
        test possibility and perhaps increment hit counter
Re:Can you solve it? The Greplin programming challenge by zmitri on Saturday October 09, 2010 @04:52AM (#1774713)
I was at work on a crappy thin client and first tried to run list(itertools.combinations(sequence)), which was crapping out. After I switched it to itertools.combinations(sequence,i) and put that right into my for loop it was fine.