Category: Interview Questions

This category to include all interview questions.

AllConstruct Solution in Java

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’. […]

BestSum Solution in Java

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

HowSum Solution in Java

Problem Statement Write a function ‘howSum(targetSum, numbers)’ that takes in a targetSum and an array of number as an arguments. The function should return an array containing any combination of elements that add up to exactly the targetSum.If there is no combination that adds up to the targetSum, then return null If there are multiple […]