Tap here to switch tabs
Problem
Submissions

Problem: Check If String Is a Prefix of Array

med
30 min
Try to solve the Check If String Is a Prefix of Array problem.

Statement

Given a string s and an array of strings words, determine if s is a prefix string of words.

A string s is a prefix string of words if it can be formed by concatenating the first kk strings in words sequentially, where kk is some integer such that 1≤k≤1 \le k \le words.length.

Return true if s is a prefix string of words, or false otherwise.

Constraints:

  • 1≤1 \le words.length ≤100\le 100

  • 1≤1 \le words[i].length ≤20\le 20

  • 1≤1 \le s.length ≤1000\le 1000

  • words[i] and s consist of only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check If String Is a Prefix of Array

med
30 min
Try to solve the Check If String Is a Prefix of Array problem.

Statement

Given a string s and an array of strings words, determine if s is a prefix string of words.

A string s is a prefix string of words if it can be formed by concatenating the first kk strings in words sequentially, where kk is some integer such that 1≤k≤1 \le k \le words.length.

Return true if s is a prefix string of words, or false otherwise.

Constraints:

  • 1≤1 \le words.length ≤100\le 100

  • 1≤1 \le words[i].length ≤20\le 20

  • 1≤1 \le s.length ≤1000\le 1000

  • words[i] and s consist of only lowercase English letters.