Problem Statement Write a function ‘allConstruct(target, wordBank)’ that accepts a target string and an array of strings. The function should return a 2D array containing all of the ways that the ‘target’ can be constructed by concatenatingelements of the ‘wordBank’ array. Each element of the 2D array should represent one combination that constructs the ‘target’. […]
Tag: dynamic programming in java
Problem Statement Write a function ‘countConstruct(target, wordBank)’ that accepts a target string and an array of strings. The function should return number of ways that the ‘target’ can be constructed byconcatenating elements of the ‘wordBank’ array. You may reuse elements of ‘wordBank’ as many times as needed. Solution
Problem Statement Write a function ‘canConstruct(target, wordBank)’ that accepts a target string and an array of strings. The function should return a boolean indicating whether or not the ‘target’ can be constructed byconcatenating elements of the ‘wordBank’ array. You may reuse elements of ‘wordBank’ as many times as needed. Solution
Problem Statement Write a function ‘bestSum(targetSum, numbers)’ that takes in a targetSum and an array of numbers as arguments. The function should return an array containing the shortest combination of numbers that add up to exactly targetSum. If there is a tie for the shortest combination, you may return any one of the shortest. Solution