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.
Day 18: Queues and Stacks
Day 18: Queues and Stacks
Sort by
recency
|
699 Discussions
|
Please Login in order to post a comment
In Python 3
import sys
class Solution:
s=input()
obj=Solution()
l=len(s)
for i in range(l): obj.pushCharacter(s[i]) obj.enqueueCharacter(s[i])
isPalindrome=True ''' pop the top character from stack dequeue the first character from queue compare both the characters ''' for i in range(l // 2): if obj.popCharacter()!=obj.dequeueCharacter(): isPalindrome=False break
if isPalindrome: print("The word, "+s+", is a palindrome.") else: print("The word, "+s+", is not a palindrome.")
HOW CAN I RECOVER A STOLEN BTC/USDT/ETH? HIRE FIXER WALLET RETRIEVAL Never took much time for me to be able to recover a stolen bitcoin worth of $124k. Reaching out to FIXER WALLET RETRIEVAL, one of the trusted and reputable hackers out here can save you the energy of becoming a stranded victim of crypto fraud. Here is how to contact these hackers; Email fixerwalletretrieval@fixer.co.site
Python 3
Javascript