Category: algorithms
Given a list of dominoes, dominoes = is equivalent to dominoes = if and only if either (a==c and b==d), or (a==d and b==c) – that is, one domino …
Given the root of a binary tree, find the maximum average value of any subtree of that tree. (A subtree of a tree is any node of that tree …
Design and implement a TwoSum class. It should support the following operations: add and find. add – Add the number to an internal data structure. find – Find if …
There is a fence with n posts, each post can be painted with one of the k colors. You have to paint all the posts such that no more …
There are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with …