Link to problem Description You are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete at most two tran...
Leetcode 1865 - Finding Pairs With a Certain Sum
Link to problem Problem You are given two integer arrays nums1 and nums2. You are tasked to implement a data structure that supports queries of two types: Add a positive integer to an element...
Leetcode 106 - Construct Binary Tree from Inorder and Postorder Traversal
Link to problem Problem Given two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder is the postorder traversal of the same tree, construct...
Leetcode 145 - Binary Tree Postorder Traversal
Link to problem Problem Given the root of a binary tree, return the postorder traversal of its nodes’ values. Solution Simple post order traversal problem. Could be solved with trivial recursiv...
Leetcode 946 - Validate Stack Sequence
Link to problem Problem Given two integer arrays pushed and popped each with distinct values, return true if this could have been the result of a sequence of push and pop operations on an initial...
Leetcode 39 - Combination Sum
Link to problem Problem Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. ...
Leetcode 1026 - Maximum Difference Between Node and Ancestor
Link to problem Problem Given the root of a binary tree, find the maximum value v for which there exist different nodes a and b where v = |a.val - b.val| and a is an ancestor of b. A node a is a...
Leetcode 2092 - Find All People With Secret
Link to problem Problem You are given an integer n indicating there are n people numbered from 0 to n - 1. You are also given a 0-indexed 2D integer array meetings where meetings[i] = [x_i, y_i, ...
Leetcode 1937 - Maximum Number of Points with Cost
Link to problem Problem You are given an m x n integer matrix points (0-indexed). Starting with 0 points, you want to maximize the number of points you can get from the matrix. To gain points, y...
Leetcode 1367 - Linked List in Binary Tree
Link to problem Problem Given a binary tree rootand a linked list with head as the first node. Return True if all the elements in the linked list starting from the head correspond to some downwa...