Given a Sudoku field as a two-dimension list, determine if the field is valid. A valid field only has the number 1-9 once in each sub-field, each row, and each column. The field is not completely filled and we donâ€™t need to check for a valid solution.
Given a list nums
and a positive integer k
, return the top k
frequent items from the list. A time complexity constraint is not given for this task.
Given an array n
of integers, find one peak in O(log*n)
time. A peak is defined as a number where the two numbers immediately left and right are strictly less than the number. Numbers outside of the bounds of this array are considered to be smaller.
Create a stack implementation that is able to return the minimum element as well as push
and pop
elements, all in constant time O(1)
.
Given a perfect binary search tree, connect all the nodes to the node on their right The solution is to do breadth-first-search in an iterative fashion. This puts all the nodes at the same level in a queue. By iterating over the queue we can connect each node to its successor. During this process we add the children of each node as the next entry. We repeat this process until the queue is empty.