Category: algorithms
Given the head of a linked list, we repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences. After doing so, return the …
There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, …, N-1, and each room may have some keys …
The power of an integer x is defined as the number of steps needed to transform x into 1 using the following steps: if x is even then x …
Given a binary search tree, return a balanced binary search tree with the same node values. A binary search tree is balanced if and only if the depth of …
Given a m * n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such …