Leetcode Solutions [Solved] There is an m x n matrix that is initialized to all 0’s. There is also a 2D array indices where each indices[i] = [ri, ci] represents a 0-indexed location to perform some increment operations on the matrix. [Solved] Given a callable function f(x, y) with a hidden formula and a value z, reverse engineer the formula and return all positive integer pairs x and y where f(x,y) == z. You may return the pairs in any order. [Solved] Balanced strings are those that have an equal quantity of ‘L’ and ‘R’ characters. Given a balanced string s, split it into some number of substrings such that: Each substring is balanced. [Solved] Given an array of integers arr, return true if the number of occurrences of each value in the array is unique, or false otherwise. [Solved] Given a string text, you want to use the characters of text to form as many instances of the word “balloon” as possible. You can use each character in text at most once. Return the maximum number of instances that can be formed. [Solved] Given the root of a binary tree, the level of its root is 1, the level of its children is 2, and so on. Return the smallest level x such that the sum of all the values of nodes at level x is maximal. [Solved] You are given an array of strings words and a string chars. A string is good if it can be formed by characters from chars (each character can only be used once). Return the sum of lengths of all good strings in words. [Solved] Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. [Solved] Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period “.” with “[.]”. [Solved] Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. [Solved] You are given an array of strings words and a string chars. A string is good if it can be formed by characters from chars (each character can only be used once). Return the sum of lengths of all good strings in words. [Solved] In an infinite binary tree where every node has two children, the nodes are labelled in row order. In the odd numbered rows (ie., the first, third, fifth,…), the labelling is left to right, while in the even numbered rows (second, fourth, sixth,…), the labelling is right to left. [Solved] We distribute some number of candies, to a row of n = num_people people in the following way: We then give 1 candy to the first person, 2 candies to the second person, and so on until we give n candies to the last person. [Solved] Given a fixed-length integer array arr, duplicate each occurrence of zero, shifting the remaining elements to the right. [Solved] A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height. Let this ordering be represented by the integer array expected where expected[i] is the expected height of the ith student in line. [Solved] You are given a string s consisting of lowercase English letters. A duplicate removal consists of choosing two adjacent and equal letters and removing them. [Solved] You are given an array of integers stones where stones[i] is the weight of the ith stone. We are playing a game with the stones. On each turn, we choose the heaviest two stones and smash them together. [Solved] Given an array nums of integers, return the length of the longest arithmetic subsequence in nums. [Solved] You are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit. [Solved] A valid parentheses string is either empty “”, “(” + A + “)”, or A + B, where A and B are valid parentheses strings, and + represents string concatenation. «Previous Page 1 2 3 4 5 … 14 Next Page»