Here's the input:

{"XXXX....", 
 "...X.XXX", 
 "XXX..X..", 
 "......X.", 
 "XXXXXXXX"}
coin_row = 2  (these are 1-indexed)
coin_col = 4

Here's a what a solution looks like with a ladder of size 2:

Your goal is to solve the problem with the minimum size ladder.









Solution 1 - Affix L, build the graph, and DFS to find a path

Example with L = 3.









Solution 2 - Sort the edges and add them incrementally with disjoint sets

Example with L = 3.