Skip to content

Commit

Permalink
reverse string, changed example.R
Browse files Browse the repository at this point in the history
  • Loading branch information
colinleach committed Jan 7, 2024
1 parent 76205f1 commit 202dd33
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions exercises/practice/reverse-string/.meta/example.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
reverse <- function(text) {
splits <- strsplit(text, "")[[1]]
reversed <- rev(splits)
paste(reversed, collapse = "")
}
strsplit(text, "") |>
lapply(rev) |>
sapply(paste, collapse = "")
}

0 comments on commit 202dd33

Please sign in to comment.