Another Solution: Longest Palindrome Substring

class Solution(object): def __init__(self): self.lookup = {“test”} def isPalindrome(self, s, i, k): j = i + k – 1 if s[i] == s[j]: key = self.createKey(i + 1, j – 1) if key in self.lookup: #self.lookup.remove(key) return True return False def createKey(self, i, j): #return “{}:{}”.format(i,j) #return (i, j) #key = bin(i) + bin(j) #return … More Another Solution: Longest Palindrome Substring

Codeforces Problem: Azamon Web Services: Solution in Python

Problem Given two string, find if using max one swap of characters, the first string is lexicographically smaller than the other string. Solution The logic is as follows: Create an index map of each character in the string A. Compare String A & String B, character-by-character. If characters are the same, move to the next … More Codeforces Problem: Azamon Web Services: Solution in Python