[Leet Code] Goal Parser Interpreter

Input: command = "G()(al)"
Output: "Goal"
Explanation: The Goal Parser interprets the command as follows:
G -> G
() -> o
(al) -> al
The final concatenated result is "Goal".
Input: command = "G()()()()(al)"
Output: "Gooooal"
Input: command = "(al)G(al)()()G"
Output: "alGalooG"
class Solution(object):
def interpret(self, command):
"""
:type command: str
:rtype: str
"""
return command.replace("(al)", "al").replace("()", "o")

--

--

--

Learning, and posting my findings!

Love podcasts or audiobooks? Learn on the go with our new app.

Parametrizing custom annotations in Spring Java

Liqo v0.4 is here!

Embrace Your Laziness: Automatically Convert Word Documents into Terms & Conditions Pages

The Bancorian | A Weekly Summary-December 5th, 2021

Week 4: Cloud Infrastructure & Networks 101

Introducing Alphadoc: A tool to level up your developer experience

Implementing Continuous Testing in DevOps Pipelines

[Leet Code] Roman to Integer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matthew Boyd

Matthew Boyd

Learning, and posting my findings!

More from Medium

LeetCode 1721: Swapping Nodes in a Linked List

Part 8 — Data Structures and Algorithms in Plain English | String Binary Search

Leetcode 8. String to Integer (atoi)

A Basic Introduction to Linked Lists