8000 uploaded code · vJechsmayr/PythonAlgorithms@8f27130 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

Commit 8f27130

Browse files
authored
uploaded code
1 parent 21fb652 commit 8f27130

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
class Solution:
2+
3+
def findSubstring(self,s, words):
4+
self.Incr = len(words[0])
5+
self.LenWords = len(words)
6+
self.Index = 0
7+
self.m = self.Incr * self.LenWords
8+
self.Max = len(s) - self.m
9+
self.output = []
10+
while self.Index <= self.Max :
11+
WordsCopy = words.copy()
12+
upperBound = self.Index
13+
lowerBound = upperBound + self.m
14+
for i in range(upperBound,lowerBound,self.Incr):
15+
tempStr = s[i: i + self.Incr]
16+
if tempStr in WordsCopy :
17+
WordsCopy.remove(tempStr)
18+
else:
19+
break
20+
if WordsCopy == [] :
21+
self.output.append(self.Index)
22+
self.Index += 1
23+
return self.output
24+
25+
26+

0 commit comments

Comments
 (0)
0