Can someone explain how this problem pattern is being solved by BFS?
I understand these BFS/DFS concepts are applicable to trees/graphs, since this problem is using arrays that are being traversed linearly, I couldn’t figure out how this comes under BFS pattern.
Thanks.