Snakes and ladder BFS-SSSP

isn’t it a good approach to do this is to just use a 2D array for the board and store snakes and ladder info in variables and for each dice throw we can compare if there is a ladder or snake or nothing

You are actually doing the same thing in the BFS approach.For each dice through, you are checking the final position in the 2D array that can be reached.
The best approach for this is to consider the given snake and ladder board as a directed graph with number of vertices equal to the number of cells in the board. The problem reduces to finding the shortest path in a graph. Since all edges are of equal weight, we can efficiently find shortest path using Breadth First Search of the graph.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.