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

@@ -0,0 +1,16 @@
# Generated by Programming+ from pseudo. Not reviewed for Mojo best practices.
# The position of the first N in T, or LENGTH(T) when there is none.
def first_unknown(t: String) -> Int:
# ENSURE 0 <= RESULT AND RESULT <= LENGTH(T)
# ENSURE FORALL K IN [0, RESULT) : T[K] != 'N'
var i: Int
i = 0
# INVARIANT FORALL K IN [0, I) : T[K] != 'N'
while i < t.count_codepoints() and String(t[codepoint=i]) != "N":
i = i + 1
return i
def main():
print(first_unknown("GATNACA"))