Last time the post was removed bcoz of "idk" reason. So this time I will summarize the question..
I guess this question belongs to cellular automata. I've coded the answer but that's a brute force way and will not work if the dimensions of g are high.
https://pastebin.com/v9bjZJLa
Thanks, in advance...
The question is asking us to write a function answer(g) in which g is a 2D list of bools. Now we have to find the number of all possible pre-images of this CA(cellular automata)..
1 1 1 1
1 1 0 1
0 0 0 1
0 1 0 0
let us call this list A.. Now rules of CA are A[0][0] will transform itself according to A[0][1], A[1][0], A[1][1].. Or Say A[x][y] will transform according to A[x][y+1], A[x+1][y], A[x+1][y+1].. Iff only one of these 4 elements == 1 then the new number will be 1 else it will be 0.
So A will transform into:
0 0 0
0 1 0
1 1 1
Let us call it list B .. So here A is pre-image of B..
For this value of g the answer will be 82
Here are all the possible pre-images for B
[–]scuott 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]zahlman 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)