5 kyu

Concatenation substring

Description:

Write

function findSubstring (s, words) {}

that given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring in s that is a concatenation of each word in words exactly once and without any intervening characters.

For example:

findSubstring("barfoofoobarthefoobarman", ["bar", "foo", "the"]) === [6, 9, 12]
findSubstring("helloworld", ["world", "hello"]) === [0]
findSubstring("helloworld", ["bar", "foo"]) === []
Performance
Algorithms

Stats:

CreatedDec 22, 2017
PublishedDec 22, 2017
Warriors Trained904
Total Skips70
Total Code Submissions2070
Total Times Completed70
JavaScript Completions70
Total Stars31
% of votes with a positive feedback rating84% of 22
Total "Very Satisfied" Votes16
Total "Somewhat Satisfied" Votes5
Total "Not Satisfied" Votes1
Total Rank Assessments5
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • joh_pot Avatar
  • SQSCWQ Avatar
Ad