Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
let is_palindrome s =
|
||||
let l = String.length s in
|
||||
let rec comp n =
|
||||
n = 0 || (s.[l-n] = s.[n-1] && comp (n-1)) in
|
||||
comp (l / 2)
|
||||
14
Task/Palindrome-detection/OCaml/palindrome-detection-2.ocaml
Normal file
14
Task/Palindrome-detection/OCaml/palindrome-detection-2.ocaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
let rem_space str =
|
||||
let len = String.length str in
|
||||
let res = Bytes.create len in
|
||||
let rec aux i j =
|
||||
if i >= len
|
||||
then (Bytes.sub_string res 0 j)
|
||||
else match str.[i] with
|
||||
| ' ' | '\n' | '\t' | '\r' ->
|
||||
aux (i+1) (j)
|
||||
| _ ->
|
||||
Bytes.set res j str.[i];
|
||||
aux (i+1) (j+1)
|
||||
in
|
||||
aux 0 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue