Tag: Leetcode

412. Fizz Buzz Python 3 Solution
Input: integer n Output: string array answer (1-indexed) where: Using If elif and modulus operator to determine if the number i is divisible by 3 and 5 then by 3 then by 5 only.

155. Min Stack
Design a stack that can return the minimum element in constant time and also support pus, pop and top methods. Example:Input[“MinStack”,”push: -3″,”push: 0″,”push: -5″,”getMin”,”pop”,”top”,”getMin”]

20. Valid Parentheses Leetcode Solution
Return boolean indicating wether the pairs of paranthesis are matching and there are no un-matched paranthesis found. Using a list to implement a stack in Python.Store all the pairs of opening and closing tags in a dictionary. Closing brackets are the key.Go.

66. Plus One LeetCode Solution in Python
Given a non empty array of decimal digits representing a non-begative integer.Increment the integer, most significant digit is on the left. Each element contains a single digit.No leading zeros except for the number 0.

Google 844. Backspace String Compare
Given two strings s and t, return True if they are equal. ‘#’ means backspace. Solution 1: use a list to implement a stack. append adds an item and pop removes it.

LeetCode 482 License Key Formatting Solution
LeetCode 482 Solution 32 ms in Python 3 You are given a license key represented by the string s that contains only alphanumeric characters and dashes. You are also given an integer k.

Google Leetcode 929 Unique Email Addresses
This solution uses the Slice in Python to slice the string as needed and a List to store unique emails found. One major trick is to use email[i:] and not just email[i]

How to reverse a string in Python 3
Write [::-1] to do slicing in Python starting at first character, until last, step by 1 in reverse (-1). It’s a pretty nice way to impress your imaginary friends.

Find the missing number in an array
Computer science job interview question:Find the missing number in the series.Write a program to calculate the missing number in the series of integers.
