Complete my palindrome

0

Create a function (preferably) or a program that takes an ordered collection and outputs the smallest possible palindrome that starts with the input.

For example:

>>> completePalindrome( [1, 2, 3] )
[1, 2, 3, 2, 1]

>>> completePalindrome( [1, 2, 3, 4, 5, 4, 3, 2] )
[1, 2, 3, 4, 5, 4, 3, 2, 1]

>>> completePalindrome( "race" )
"racecar"

You may choose to support as many of your language's data types as you want to.

Have fun!

theonlygusti

Posted 2017-02-06T08:44:53.140

Reputation: 1 221

Question was closed 2017-02-06T08:47:14.520

2Are we allowed to support just one datatype, eg a string or a list? – Okx – 2017-02-06T08:46:22.407

2[1,2,3,4,5,3,2,1] isnt a palindrome. – Matthew Roh – 2017-02-06T08:46:25.650

No answers