Baseline: tree as shared

This commit is contained in:
alexm committed 2026-10-05 03:03:38 +00:00
commit 31f2fb8a5a
1679 files changed
+1024562

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
# Generated by Programming+ from pseudo. Not reviewed for Mojo best practices.
# How many positions of T hold the base B.
def count_base(b: String, t: String) -> Int:
# Set up
var n: Int
var total: Int
n = t.count_codepoints()
total = 0
# Visit each position
for i in range(n):
# Test this position
if String(t[codepoint=i]) == b:
# Update the running total
total = total + 1
# Report
return total
def main():
print(count_base("A", "GATTACA"))