Tap here to switch tabs
Problem
Submissions

Problem: Longest String Chain

Longest String Chain gives an array of words; return the maximum chain length when each next word is formed by inserting exactly one letter into the previous word.

Statement

Given an array words, where each word consists of lowercase English letters, a word word_A is considered a predecessor of word_B if and only if exactly one letter can be inserted anywhere into word_A (without reordering the remaining characters) to produce word_B.

A word chain is a sequence [word_1, word_2, ..., word_k] where k≥1k \geq 1, and each word is a predecessor of the next. A single word trivially forms a word chain of length 11.

Return the length of the longest possible word chain using words chosen from the given words array.

Constraints:

  • 1≤1 \leq words.length ≤103\leq 10^3

  • 1≤1 \leq words[i].length ≤16\leq 16

  • words[i] consists only of lowercase English letters

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest String Chain

Longest String Chain gives an array of words; return the maximum chain length when each next word is formed by inserting exactly one letter into the previous word.

Statement

Given an array words, where each word consists of lowercase English letters, a word word_A is considered a predecessor of word_B if and only if exactly one letter can be inserted anywhere into word_A (without reordering the remaining characters) to produce word_B.

A word chain is a sequence [word_1, word_2, ..., word_k] where k≥1k \geq 1, and each word is a predecessor of the next. A single word trivially forms a word chain of length 11.

Return the length of the longest possible word chain using words chosen from the given words array.

Constraints:

  • 1≤1 \leq words.length ≤103\leq 10^3

  • 1≤1 \leq words[i].length ≤16\leq 16

  • words[i] consists only of lowercase English letters