Tag: c++
On a N * N grid, we place some 1 * 1 * 1 cubes. Each value v = grid represents a tower of v cubes placed on top …
Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Input: Output: 4 Explanation: The longest increasing subsequence is , therefore the length is 4. …
You have some coins. The i-th coin has a probability prob of facing heads when tossed. Return the probability that the number of coins facing heads equals target if …
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the depth of the two …
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order …