Showing 2 questions
Given a grid representing land and water, count the number of distinct islands. An island is formed by connected land cells.
#1. Number of Islands
Find the k most frequently occurring words in a given list of words. Return the top k words sorted by frequency, and then alphabetically for words with the same frequency.
#2. Top K Frequent Words