Coding Exercise Posts - page 21 of 43

Recent posts

Tree with Distinct Parities

less than 1 minute read

Given a binary tree root, return the number of perfect nodes. A perfect node has two properties:

Tree Traversal

1 minute read

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...

Tree Sum

less than 1 minute read

Given a binary tree root, return the sum of all values in the tree.

Tree Pruning

less than 1 minute read

Given a binary tree root, prune the tree so that subtrees containing all 0s are removed.

Tree From Pre/Inorder Traversals

less than 1 minute read

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...

Tree Coloring

1 minute read

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...

Transpose of a Matrix

less than 1 minute read

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...

Toeplitz Matrix

less than 1 minute read

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...

Tic Tac Toe

2 minute read

Implement the tic-tac-toe game with the following methods:

Text Editor

less than 1 minute read

Given a string s representing characters typed into an editor, with "<-" representing a backspace, return the current state of the editor.

Task Hare

1 minute read

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...

Target Number with Operations

less than 1 minute read

Given positive integers start and end (start < end), return the minimum number of operations needed to convert start to end using these operations: