Category: dynamic programming
Given an array A of integers, return the length of the longest arithmetic subsequence in A. Recall that a subsequence of A is a list A, A, …, A …
A sequence X_1, X_2, …, X_n is fibonacci-like if: n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 <= n Given a strictly increasing array …
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 an integer array arr and an integer difference, return the length of the longest subsequence in arr which is an arithmetic sequence such that the difference between adjacent …