To solve this problem, you'll have to open it on the computer

Removing all adjacent dupicates in a string

Strings
easy
Score: 30

Given a string s which consists of lowercase English letters. Removing duplicates means choosing two adjacent and equal letters and removing them.

We repeatedly make duplicate removals on s until we no longer can.

Return the final string after all such duplicate removals have been made.(Answer is proven as unique)

Input Format

First Parameter - String s

Output Format

Return the string

Example 1:

Input: s = "abbaca"
Output: "ca"
Explanation: From the "abbaca" remove bb then the result is aaca then 
again remove aa which makes the remaing string as "ca".

Example 2:

Input: s = "azxxzy"
Output: "ay"

Constraints:

  • 1 <= s.length <= 105
  • s consists of lowercase English letters.
  • Time complexity: O(n)
  • Auxillary space complexity: O(n)
Submit code to see the your result here