Tree with Distinct Parities
Given a binary tree root, return the number of perfect nodes. A perfect node has two properties:
Given a binary tree root, return the number of perfect nodes. A perfect node has two properties:
You are given a tree root and a list of strings moves consisting of "RIGHT", "LEFT" and "UP". Starting from root, traverse the tree by performing each move i...
Given a binary tree root, return the sum of all values in the tree.
Given a binary tree root, prune the tree so that subtrees containing all 0s are removed.
Given a list of unique integers preorder and another list of unique integers inorder, representing the pre-order and in-order traversals of a binary tree, re...
You are given a binary tree root where the value of each node represents its color. In the tree there are at most 2 colors. Return whether it’s possible to s...
Given an integer square (n by n) matrix, return its transpose. A transpose of a matrix switches the row and column indices. That is, for every r and c, matri...
Given a two-dimensional matrix of integers matrix, determine whether it’s a Toeplitz matrix. A Toeplitz is one where every diagonal descending from left to r...
Implement the tic-tac-toe game with the following methods:
Given a string s representing characters typed into an editor, with "<-" representing a backspace, return the current state of the editor.
You are given a list of integers tasks and another list of integers people. The integer tasks[i] represents the amount of strength required to perform the it...
Given positive integers start and end (start < end), return the minimum number of operations needed to convert start to end using these operations: