Google | Phone screen | Shortest Way to Form String

Create string a out of substrings of string b. Return the minimum number of copies that you need to do this.

Example 1:

Input: a="zaza", b="baz"
Output: 3
Explanation:
copy1="z"
copy2="az"
copy3="a
a=copy1+copy2+copy3

https://leetcode.com/problems/shortest-way-to-form-string (premium)

Comments (9)