For Number of islands question: Here was a follow up question that I was asked:
What if the dataset which refers to the grid map is really large, how to solve it efficiently?