Tap here to switch tabs
Problem
Submissions

Problem: Count Distinct Ways to Form Target from Two Strings

Try to solve the Count Distinct Ways to Form Target from Two Strings problem.

Statement

You are given three strings word1, word2, and target.

Return the total number of distinct ways to construct target by selecting and interleaving characters from word1 and word2.

A selection of characters is valid if:

  • The characters chosen from word1 maintain their relative order in word1.

  • The characters chosen from word2 maintain their relative order in word2.

  • At least 11 character is selected from word1 and at least 11 character is selected from word2.

  • The concatenated sequence of selected characters equals target.

Two ways are considered distinct if they use a different sequence of indices from word1 or word2.

Constraints:

  • 1≤1 \leq word1.length, word2.length, target.length ≤100\leq 100

  • word1, word2, and target consist of lowercase English letters only.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Distinct Ways to Form Target from Two Strings

Try to solve the Count Distinct Ways to Form Target from Two Strings problem.

Statement

You are given three strings word1, word2, and target.

Return the total number of distinct ways to construct target by selecting and interleaving characters from word1 and word2.

A selection of characters is valid if:

  • The characters chosen from word1 maintain their relative order in word1.

  • The characters chosen from word2 maintain their relative order in word2.

  • At least 11 character is selected from word1 and at least 11 character is selected from word2.

  • The concatenated sequence of selected characters equals target.

Two ways are considered distinct if they use a different sequence of indices from word1 or word2.

Constraints:

  • 1≤1 \leq word1.length, word2.length, target.length ≤100\leq 100

  • word1, word2, and target consist of lowercase English letters only.