57. Reverse a string

EasyProgramFree10 points

Write reverseString s, which returns the characters of s in reverse order.

Characters are Unicode characters, not bytes: "λx" reverses to "xλ".

Examples

  1. Input: reverseString "hello"Output: "olleh"
  2. Input: reverseString "Lean"Output: "naeL"
  3. Input: reverseString ""Output: ""

Submitting also runs 5 hidden tests.

Solution.lean
Loading editor…

Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.

ReadyLn 1, Col 1Lean 4
Draft saved in this browser