Algorithm challenge // Palindrome Swapper
1. Getting started
https://github.com/nataliaero/palindrome_swapper
Fork this repo and then git clone
your forked repo to your computer. Once happy with your solution, git push
and submit a pull request at https://github.com/nataliaero/palindrome_swapper
or send an email to natorgom@gmail.com
2. Challenge
Write a function called palindromeSwapper
that determines if a palindrome can be created by swapping two adjacent characters in the string. The function should return the palindrome if found or -1
if not found.
2.1. Examples
Input => output
----------------------------
"rcaecar" => racecar
"abcde" => -1
2.2. Testing your solution
To test your solution, run npm install
in the root directory and then run npm test
to run the automated tests.
2.3. Submitting your solution
You have 2 options to submit your solution:
- If you're working on a forked repo, push your changes to your forked repo and submit a pull request to this repo
- Send an email with your solution to
natorgom@gmail.com
and I will confirm