You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are given a string s and an array of strings words. All the strings of words are of the same length.
3
+
4
+
A concatenated substring in s is a substring that contains all the strings of any permutation of words concatenated.
5
+
6
+
For example, if words = ["ab","cd","ef"], then "abcdef", "abefcd", "cdabef", "cdefab", "efabcd", and"efcdab" are all concatenated strings. "acdbef" is not a concatenated substring because it is not the concatenation of any permutation of words.
7
+
Return the starting indices of all the concatenated substrings in s. You can return the answer in any order.
8
+
9
+
10
+
11
+
Example 1:
12
+
13
+
Input: s = "barfoothefoobarman", words = ["foo","bar"]
14
+
Output: [0,9]
15
+
Explanation: Since words.length == 2and words[i].length == 3, the concatenated substring has to be of length 6.
16
+
The substring starting at 0 is "barfoo". It is the concatenation of ["bar","foo"] which is a permutation of words.
17
+
The substring starting at 9 is "foobar". It is the concatenation of ["foo","bar"] which is a permutation of words.
18
+
The output order does not matter. Returning [9,0] is fine too.
19
+
Example 2:
20
+
21
+
Input: s = "wordgoodgoodgoodbestword", words = ["word","good","best","word"]
22
+
Output: []
23
+
Explanation: Since words.length == 4and words[i].length == 4, the concatenated substring has to be of length 16.
24
+
There is no substring of length 16 is s that is equal to the concatenation of any permutation of words.
25
+
We return an empty array.
26
+
Example 3:
27
+
28
+
Input: s = "barfoofoobarthefoobarman", words = ["bar","foo","the"]
29
+
Output: [6,9,12]
30
+
Explanation: Since words.length == 3and words[i].length == 3, the concatenated substring has to be of length 9.
31
+
The substring starting at 6 is "foobarthe". It is the concatenation of ["foo","bar","the"] which is a permutation of words.
32
+
The substring starting at 9 is "barthefoo". It is the concatenation of ["bar","the","foo"] which is a permutation of words.
33
+
The substring starting at 12 is "thefoobar". It is the concatenation of ["the","foo","bar"] which is a permutation of words.
-> This program makes the any directory of the file manager looks cool by managing all the content of the specific directory. It store all content by creating seperate
2
+
folder for images,media,document and also create Others folder to store the content which is not relevant to remaining 3 folders.
3
+
-> It seperate the content by checking its extension.
4
+
eg. if the extension of the file is .mp3 then that file will get store in media folder.
5
+
-> The program takes any directory path as an input and then seperate the content according to their extension and store it in the given folder which is mentioned above.
- The program makes the any directory of the file manager looks cool by managing all the content of the specific directory. It store all content by creating seperate
3
+
folder for images,media,document and also create Others folder to store the content which is not relevant to remaining 3 folders.
4
+
- It seperate the content by checking its extension.
5
+
eg. if the extension of the file is .mp3 then that file will get store in media folder.
6
+
- The program takes any directory path as an input and then seperate the content according to their extension and store it in the given folder which is mentioned above.
Given an array ‘pages’ of integer numbers, where ‘pages[i]’ represents the number of pages in the ‘i-th’ book. There are ‘m’ number of students, and the task is to allocate all the books to their students.
4
+
5
+
Allocate books in a way such that:
6
+
7
+
1. Each student gets at least one book.
8
+
9
+
2. Each book should be allocated to a student.
10
+
11
+
3. Book allocation should be in a contiguous manner.
12
+
13
+
You have to allocate the books to ‘m’ students such that the maximum number of pages assigned to a student is minimum.
0 commit comments