I would like to start saying that your proposed solutions are clever and yield good results, as you probably already know :D. After some debugging it is not very difficult to catch the logic of the program. In terms of correctness of your solution I have honestly nothing to say. I could point out some personal observations:
I would suggest to add some more comments here and there since the general intention of the algorithm is effectively explained, but some lines of code are quite long and it can get confusing when following step by step.
In general, I think the handling of the set objects could be done in a very slightly more efficient (and readable) way. Just as an example, in the add_list function, you have these lines of code:
if not any(element == i for element in state[0]):
state[0]= set(list(state[0]) + list(l))
state[1]= set(list(state[1]) + [lists.index(l)])
return
The following lines do the same, though they exploit the set object properties:
if i not in state[0]:
state[0] |= set(l)
state[1] |= set([lists.index(l)])
return
Other than these I can't really find something substantially important to mention. Even the previous comment is a bit of a stretch from my side, I'll admit. Props to you for implementing even your personal fused approach, it is quite impressive!
Hi,
I would like to start saying that your proposed solutions are clever and yield good results, as you probably already know :D. After some debugging it is not very difficult to catch the logic of the program. In terms of correctness of your solution I have honestly nothing to say. I could point out some personal observations:
set
objects could be done in a very slightly more efficient (and readable) way. Just as an example, in theadd_list
function, you have these lines of code:The following lines do the same, though they exploit the
set
object properties:Other than these I can't really find something substantially important to mention. Even the previous comment is a bit of a stretch from my side, I'll admit. Props to you for implementing even your personal fused approach, it is quite impressive!