I have an array 'board_matrix' with some values in it. And I also have another array 'win' with some indices values. Now I want to make 'board_matrix' go all zero except those indices in 'win' array.
say,
board_matrix = [1,0,2,2,1,0,1,0,1]
win = [0,4,8]
then output should be
new_array = [1,0,0,0,1,0,0,0,1]
win
to aSet<Int>
? Then you can iterate over the array and usewin.contains(index)
- Paulw11