Fix: Ensure all skills are tracked as files, not submodules
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
# HumanEval/10
|
||||
# Loki Mode Multi-Agent Solution
|
||||
# Attempts: 1
|
||||
# Passed: True
|
||||
|
||||
def is_palindrome(string: str) -> bool:
|
||||
""" Test if given string is a palindrome """
|
||||
return string == string[::-1]
|
||||
|
||||
|
||||
def make_palindrome(string: str) -> str:
|
||||
""" Find the shortest palindrome that begins with a supplied string.
|
||||
Algorithm idea is simple:
|
||||
- Find the longest postfix of supplied string that is a palindrome.
|
||||
- Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
|
||||
>>> make_palindrome('')
|
||||
''
|
||||
>>> make_palindrome('cat')
|
||||
'catac'
|
||||
>>> make_palindrome('cata')
|
||||
'catac'
|
||||
"""
|
||||
if not string:
|
||||
return ''
|
||||
|
||||
for i in range(len(string)):
|
||||
if is_palindrome(string[i:]):
|
||||
return string + string[:i][::-1]
|
||||
|
||||
return string
|
||||
Reference in New Issue
Block a user