Problem Description Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, ...
Find Peak Element
Problem Description A peak element is an element that is strictly greater than its neighbors. Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains...
Minimum Genetic Mutation
PROBLEM DESCRIPTION A gene string can be represented by an 8-character long string, with choices from ‘A’, ‘C’, ‘G’, and ‘T’. Suppose we need to investigate a mutation from a gene string startGene...
Snakes and Ladders
PROBLEM DESCRIPTION You are given an n x n integer matrix board where the cells are labeled from 1 to n2 in a Boustrophedon style starting from the bottom left of the board (i.e. board[n - 1][0]) ...
Evaluate Division
PROBLEM DESCRIPTION You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi = values[i]. ...
Search Insert Position
PROBLEM DESCRIPTION Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. ...
Minimum Absolute Difference in BST
PROBLEM DESCRIPTION Given the root of a Binary Search Tree (BST), return the minimum absolute difference between the values of any two different nodes in the tree. leetcode SOLUTION We should b...
Lowest Common Ancestor of a Binary Tree
PROBLEM DESCRIPTION Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defi...
Binary Search Tree Iterator
PROBLEM DESCRIPTION Implement the BSTIterator class that represents an iterator over the in-order traversal of a binary search tree (BST): -BSTIterator(TreeNode root) Initializes an object of the...
Count Complete Tree Nodes
PROBLEM DESCRIPTION Given the root of a complete binary tree, return the number of the nodes in the tree. According to Wikipedia, every level, except possibly the last, is completely filled in a ...