Free written solution

Longest Word in Dictionary through Deleting (LeetCode 524): Solution and Explanation

Find the longest dictionary word you can get by deleting letters from s. Ties go to the lexicographically smallest word, and if no word fits, return the empty string.

Read the intuition, approach, code and complexity →