Facebook / Meta | Phone | Missing Number / Word Break
Anonymous User
4620

First question:

Given an array of integers, return true or false if the numbers in the array go from 0... (N - 1) where N is the length of the array

Linear time, constant space is a requirement

example:
[0,1,2,3,4] = true;
[4,2,1,0,3] = true;
[0,1,5,2,4] = false;

Second question

given a string and a dictionary, check to see if the string can be broken up into the words in the dictionary:

example:
TRUE:
string: 'helloworld' dictionary = {hello, world} 

FALSE:
string: "helloxworld" dictionary = {hello,world}

TRUE:
string: "showerbathtubhello" dictionary = {shower, bath, tub, hello}

Comments (19)