Sort by

recency

|

698 Discussions

|

  • + 0 comments

    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

  • + 0 comments

    Python 3

    class Solution:
        def __init__(self):
            self.stack=[]
            self.queue=[]
        def pushCharacter(self,char):
            self.stack.append(char)
            return self.stack
        def popCharacter(self):
            return self.stack.pop()
        def enqueueCharacter(self,char):
            self.queue.append(char)
            return self.queue
        def dequeueCharacter(self):
            return self.stack.pop(0)
        # Write your code here
    
    # read the string s
    s=input()
    #Create the Solution class object
    obj=Solution()   
    
    l=len(s)
    # push/enqueue all the characters of string s to stack
    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
    #finally print whether string s is palindrome or not.
    if isPalindrome:
        print("The word, "+s+", is a palindrome.")
    else:
        print("The word, "+s+", is not a palindrome.")    
    
  • + 0 comments

    Javascript

    class Solution{
      
      constructor(){
        this.stack = [];
        this.queue = [];
      }
      
      pushCharacter(char){
        //store original array here
        this.stack.push(char);
      }  
        
      enqueueCharacter(char){
        //store reverse array here
        this.queue.unshift(char);
      }
      
      popCharacter(){
        //return first character from stack
        return this.stack.pop();
      }
      
      dequeueCharacter(){
        //return first character from queue
        return this.queue.pop();
      }
      
    }
    
  • + 1 comment
    class Solution:
        def __init__(self):
            self.stack=[]
            self.queue=[]
        def pushCharacter(self,x):
            self.stack.append(x)
        def enqueueCharacter(self,x):
            self.queue.insert(0,x)
        def popCharacter(self):
            return self.stack.pop()
        def dequeueCharacter(self):
            return self.queue.pop()
        
    
  • + 0 comments

    There is a PHP error with the code provided.

    PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in Solution.php on line 34