Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
Two-pointer palindrome check:
let is_palindrome s =
let n = String.length s in
let rec check i j =
if i >= j then true
else if s.[i] <> s.[j] then false
else check (i + 1) (j - 1)
in
check 0 (n - 1)
Tests on six strings:
racecar = true
hello = false
abba = true
'' = true (vacuously, i >= j on entry)
'a' = true
'ab' = false
Sum = 4.
Uses s.[i] <> s.[j] (string-get + structural inequality), recursive
2-arg pointer advancement, and a multi-clause if/else if/else for
the three cases.
48 baseline programs total.
53 lines
1.0 KiB
JSON
53 lines
1.0 KiB
JSON
{
|
|
"ackermann.ml": 125,
|
|
"anagrams.ml": 3,
|
|
"bag.ml": 3,
|
|
"bits.ml": 21,
|
|
"balance.ml": 3,
|
|
"bfs.ml": 6,
|
|
"btree.ml": 39,
|
|
"brainfuck.ml": 75,
|
|
"caesar.ml": 215,
|
|
"calc.ml": 13,
|
|
"closures.ml": 315,
|
|
"coin_change.ml": 6,
|
|
"csv.ml": 10,
|
|
"exception_handle.ml": 4,
|
|
"expr_eval.ml": 16,
|
|
"factorial.ml": 3628800,
|
|
"fraction.ml": 7,
|
|
"frequency.ml": 5,
|
|
"grep_count.ml": 3,
|
|
"hanoi.ml": 1023,
|
|
"fizzbuzz.ml": 57,
|
|
"list_ops.ml": 30,
|
|
"json_pretty.ml": 24,
|
|
"kadane.ml": 6,
|
|
"lambda_calc.ml": 7,
|
|
"levenshtein.ml": 11,
|
|
"memo_fib.ml": 75025,
|
|
"merge_sort.ml": 44,
|
|
"module_use.ml": 3,
|
|
"newton_sqrt.ml": 1414,
|
|
"mutable_record.ml": 10,
|
|
"option_match.ml": 5,
|
|
"palindrome.ml": 4,
|
|
"pascal.ml": 252,
|
|
"pi_leibniz.ml": 314,
|
|
"pretty_table.ml": 64,
|
|
"poly_stack.ml": 5,
|
|
"queens.ml": 2,
|
|
"quicksort.ml": 44,
|
|
"roman.ml": 44,
|
|
"rpn.ml": 9,
|
|
"run_length.ml": 11,
|
|
"safe_div.ml": 20,
|
|
"shuffle.ml": 55,
|
|
"word_freq.ml": 8,
|
|
"sieve.ml": 15,
|
|
"sum_squares.ml": 385,
|
|
"unique_set.ml": 9,
|
|
"validate.ml": 417,
|
|
"word_count.ml": 3
|
|
}
|