how to use HashTable to solve this problem???

i've already checked almost half of the solutions, but no one use HashTable to solve this.

can anyone give a HashTable solution and paste the code???

solutions almost divided into two type but no HashTable:

first: DFS

second: loop the two dimension array's elements