1812. Determine Color of a Chessboard Square

1812. Determine Color of a Chessboard Square You are given coordinates, a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference. Return true if the square is white, and false if the square is black. The coordinate will always represent a valid chessboard square. The coordinate will always have the letter first, and the number second. 1 2 3 4 5 Example 1: Input: coordinates = "a1" Output: false Explanation: From the chessboard above, the square with coordinates "a1" is black, so return false....

<span title='2021-04-03 00:00:00 +0000 UTC'>April 3, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1814. Count Nice Pairs in an Array

1814. Count Nice Pairs in an Array You are given an array nums that consists of non-negative integers. Let us define rev(x) as the reverse of the non-negative integer x. For example, rev(123) = 321, and rev(120) = 21. A pair of indices (i, j) is nice if it satisfies all of the following conditions: 0 <= i < j < nums.length nums[i] + rev(nums[j]) == nums[j] + rev(nums[i]) Return the number of nice pairs of indices....

<span title='2021-04-03 00:00:00 +0000 UTC'>April 3, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

563. Binary Tree Tilt

563. Binary Tree Tilt Given the root of a binary tree, return the sum of every tree node’s tilt. The tilt of a tree node is the absolute difference between the sum of all left subtree node values and all right subtree node values. If a node does not have a left child, then the sum of the left subtree node values is treated as 0. The rule is similar if there the node does not have a right child....

<span title='2021-04-02 00:00:00 +0000 UTC'>April 2, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

235. Lowest Common Ancestor of a Binary Search Tree

235. Lowest Common Ancestor of a Binary Search Tree Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself)....

<span title='2021-03-29 00:00:00 +0000 UTC'>March 29, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1441. Build an Array With Stack Operations

1441. Build an Array With Stack Operations Given an array target and an integer n. In each iteration, you will read a number from list = {1,2,3…, n}. Build the target array using the following operations: Push: Read a new element from the beginning list, and push it in the array. Pop: delete the last element of the array. If the target array is already built, stop reading more elements. Return the operations to build the target array....

<span title='2021-03-27 00:00:00 +0000 UTC'>March 27, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

199. Binary Tree Right Side View

199. Binary Tree Right Side View Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. 1 2 3 4 Example 1: Input: root = [1,2,3,null,5,null,4] Output: [1,3,4] 1 2 3 4 Example 2: Input: root = [1,null,3] Output: [1,3] 1 2 3 4 Example 3: Input: root = [] Output: [] Constraints:...

<span title='2021-03-27 00:00:00 +0000 UTC'>March 27, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

108. Convert Sorted Array to Binary Search Tree

108. Convert Sorted Array to Binary Search Tree Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree. A height-balanced binary tree is a binary tree in which the depth of the two subtrees of every node never differs by more than one. 1 2 3 4 5 Example 1: Input: nums = [-10,-3,0,5,9] Output: [0,-3,9,-10,null,5] Explanation: [0,-10,5,null,-3,null,9] is also accepted: 1 2 3 4 5 Example 2: Input: nums = [1,3] Output: [3,1] Explanation: [1,3] and [3,1] are both a height-balanced BSTs....

<span title='2021-03-13 00:00:00 +0000 UTC'>March 13, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

110. Balanced Binary Tree

110. Balanced Binary Tree Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the left and right subtrees of every node differ in height by no more than 1. 1 2 3 4 Example 1: Input: root = [3,9,20,null,null,15,7] Output: true 1 2 3 4 Example 2: Input: root = [1,2,2,3,3,null,null,4,4] Output: false 1 2 3 4 Example 3: Input: root = [] Output: true Constraints:...

<span title='2021-03-13 00:00:00 +0000 UTC'>March 13, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

111. Minimum Depth of Binary Tree

111. Minimum Depth of Binary Tree Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node with no children. 1 2 3 4 Example 1: Input: root = [3,9,20,null,null,15,7] Output: 2 1 2 3 4 Example 2: Input: root = [2,null,3,null,4,null,5,null,6] Output: 5 Constraints:...

<span title='2021-03-12 00:00:00 +0000 UTC'>March 12, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

100. Same Tree

![https://leetcode.com/problems/same-tree/] Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. 1 2 3 4 Example 1: Input: p = [1,2,3], q = [1,2,3] Output: true 1 2 3 4 Example 2: Input: p = [1,2], q = [1,null,2] Output: false 1 2 3 4 Example 3: Input: p = [1,2,1], q = [1,1,2] Output: false Constraints:...

<span title='2021-03-11 00:00:00 +0000 UTC'>March 11, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

101. Symmetric Tree

!()[https://leetcode.com/problems/symmetric-tree/] Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). 1 2 3 4 Example 1: Input: root = [1,2,2,3,4,4,3] Output: true 1 2 3 4 Example 2: Input: root = [1,2,2,null,3,null,3] Output: false Constraints: The number of nodes in the tree is in the range [1, 1000]. -100 <= Node.val <= 100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 /** * Definition for a binary tree node....

<span title='2021-03-11 00:00:00 +0000 UTC'>March 11, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

104. Maximum Depth of Binary Tree

104. Maximum Depth of Binary Tree Given the root of a binary tree, return its maximum depth. A binary tree’s maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 1 2 3 4 Example 1: Input: root = [3,9,20,null,null,15,7] Output: 3 1 2 3 4 Example 2: Input: root = [1,null,2] Output: 2 1 2 3 4 Example 3: Input: root = [] Output: 0 1 2 3 4 Example 4: Input: root = [0] Output: 1 Constraints:...

<span title='2021-03-11 00:00:00 +0000 UTC'>March 11, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

112. Path Sum

112. Path Sum Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum. A leaf is a node with no children. 1 2 3 4 Example 1: Input: root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22 Output: true 1 2 3 4 Example 2: Input: root = [1,2,3], targetSum = 5 Output: false 1 2 3 4 Example 3: Input: root = [1,2], targetSum = 0 Output: false Constraints:...

<span title='2021-03-11 00:00:00 +0000 UTC'>March 11, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

113. Path Sum II

113. Path Sum II Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where each path’s sum equals targetSum. A leaf is a node with no children. 1 2 3 4 Example 1: Input: root = [5,4,8,11,null,13,4,7,2,null,null,5,1], targetSum = 22 Output: [[5,4,11,2],[5,8,4,5]] 1 2 3 4 Example 2: Input: root = [1,2,3], targetSum = 5 Output: [] 1 2 3 4 Example 3: Input: root = [1,2], targetSum = 0 Output: [] Constraints:...

<span title='2021-03-11 00:00:00 +0000 UTC'>March 11, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

997. Find the Town Judge

![https://leetcode.com/problems/find-the-town-judge/] In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: The town judge trusts nobody. Everybody (except for the town judge) trusts the town judge. There is exactly one person that satisfies properties 1 and 2. You are given trust, an array of pairs trust[i] = [a, b] representing that the person labelled a trusts the person labelled b....

<span title='2021-03-06 00:00:00 +0000 UTC'>March 6, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx