Community

Start a Thread


Notifications
Subscribe You’re not receiving notifications from this thread.

String Breakdown (Main Thread)

Here is the interview question prompt, presented for reference.

We're given a string and need to see if it can be broken down into words from a dictionary array. For example:

const str = "applecomputer";
const dictArr = ["apple", "computer"];
stringBreakdown(str, dictArr);
// true

Assuming that there are no repeats in the dictionary array, can you write a method that will return true if the string can be broken down into words from the array, or false if not?

Constraints

  • Length of the string <= 1000
  • The string is made up of ASCII characters (all or some of it)
  • Expected time complexity : O(n^2)
  • Expected space complexity : O(n)

You can see the full challenge with visuals at this link.

Challenges • Asked over 6 years ago by Jake from AlgoDaily

Jake from AlgoDaily Commented on Nov 30, 2017:

This is the main discussion thread generated for String Breakdown.