Baseline: tree as shared
This commit is contained in:
1679 files changed
+1024562
No files matched your search
@@ -0,0 +1,23 @@
|
||||
# Generated by Programming+ from pseudo. Not reviewed for Mojo best practices.
|
||||
|
||||
# Matched is reset in the wrong place.
|
||||
def match_(p: String, t: String) -> List[Int]:
|
||||
var n: Int
|
||||
var m: Int
|
||||
var matched: Bool
|
||||
var answer = List[Int]()
|
||||
n = t.count_codepoints()
|
||||
m = p.count_codepoints()
|
||||
matched = True
|
||||
for i in range(n - m + 1):
|
||||
for j in range(m):
|
||||
if String(t[codepoint=i + j]) != String(p[codepoint=j]):
|
||||
matched = False
|
||||
break
|
||||
if matched:
|
||||
answer.append(i)
|
||||
return answer.copy()
|
||||
|
||||
|
||||
def main():
|
||||
print(match_("GC", "GATGCA"))
|
||||
Reference in new issue
Block a user