We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I shamefully had to copy your solution because I couldn't come up with my one. I tried breaking down the list-comprehensions into for loops and i tried reverting the logic (instead of finding those with x mod a(i) != 0 I tried finding those where x mod a(i) = 0). I couldn't get it working. Could you please elaborated on this solution? If I understand it (a bit and not sure), you first find in the range 0..max(b) the list of those where x mod a(i) is not = 0 and then by exclusion extract those with x mod a(i) = 0; then use this list to find those where b mod x is not = 0 (again) and then finally exclude these from l2 and voila, you have the list of actual in-between-ers.
My head is spinning....
I find depressing from my perspective that you are "new" to python and yet so good at list comprehension..
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
I shamefully had to copy your solution because I couldn't come up with my one. I tried breaking down the list-comprehensions into for loops and i tried reverting the logic (instead of finding those with x mod a(i) != 0 I tried finding those where x mod a(i) = 0). I couldn't get it working. Could you please elaborated on this solution? If I understand it (a bit and not sure), you first find in the range 0..max(b) the list of those where x mod a(i) is not = 0 and then by exclusion extract those with x mod a(i) = 0; then use this list to find those where b mod x is not = 0 (again) and then finally exclude these from l2 and voila, you have the list of actual in-between-ers. My head is spinning....
I find depressing from my perspective that you are "new" to python and yet so good at list comprehension..