We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Highest Value Palindrome
Highest Value Palindrome
Sort by
recency
|
536 Discussions
|
Please Login in order to post a comment
My code does not use the typical two phase approach. It finish the changes in one sweep.
def highestValuePalindrome(s, n, k): # Write your code here
def highestValuePalindrome(s, n, k): # convert to list so we can modify characters s = list(s) changed = [False] * n # track positions changed in phase 1 i, j = 0, n - 1 used = 0