Leetcode 20: Valid Parentheses

Problem Statement Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Every close bracket has a corresponding open bracket of the same type. Example 1: Input: s = "()" Output: true Example 2: Input: s = "()[]{}" Output: true Example 3: Input: s = "(]" Output: false Solution Intuition & Patterns Leetcode #20, Valid Parentheses, is a great introduction to LIFO (last in first out) stack problems....

January 10, 2023 路 3 min 路 438 words 路 Me

Leetcode 1 Two Sum

Introduction After weeks of preparation, the big day has finally arrived. At 10:28 am PST, Javier (馃懆) is moments away from his first interview with Jordanna (馃懇), a senior software engineer at MAANG inc. The zoom call begins. 馃懇 鈥淭hanks for taking the time to interview with us today. We鈥檒l start off with brief introductions. My name is Jordanna and I earned my M.Sc. from UPenn before joining MAANG six years ago....

January 2, 2023 路 5 min 路 943 words 路 Me

Leetcode 127 Word Ladder

Problem Statement A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that: Every adjacent pair of words differs by a single letter. Every si for 1 <= i <= k is in wordList. Note that beginWord does not need to be in wordList. sk == endWord Given two words, beginWord and endWord, and a dictionary wordList, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists....

December 8, 2022 路 3 min 路 475 words 路 Me