Problem · Dynamic Programming
String Formation
Learn this problemProblem statement
All words have equal length. Form target by choosing its characters from strictly increasing column indices; at a chosen column, the character may come from any word. Count distinct index-and-word choices modulo 10^9 + 7.
Function
numWays(words: String[], target: String) → intExamples
Example 1
words = ["adc","aec","efg"]target = "ac"return = 4There are two choices for 'a' in column zero and two choices for 'c' in column two.
Constraints
1 <= words.length <= 10001 <= words[i].length <= 30001 <= target.length <= words[i].length- All characters are lowercase English letters.
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024