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

+15
View File
@@ -0,0 +1,15 @@
// CALL: COUNT_GC("GATTACA")
// ERRORS: 2
// Count the G and C bases in T. This version has five mistakes;
// the coach finds all of them before anything runs.
FUNCTION COUNT_GC(T : STRING) RETURNS INTEGER
DECLARE Total : INTEGER
DECLARE Unused : FLOAT
FOR I <- 0 TO LENGTH(T) - 1
Total <- 0
IF T[I] == "G" OR T[I] == 'C' THEN
Total = Total + 1
ENDIF
NEXT I
RETURN Total
ENDFUNCTION