Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1’s in the binary representation of i.
You are given an integer n. Your task is to break it into a sum of at least two positive integers such that the product of these integers is maximized. Return the maximum product that can be obtained.
You are given a set of distinct positive integers. Return the largest subset where every pair of elements in the subset satisfies either ‘one element is divisible by the other’.
In this game, you must guess a number between 1 and n. Each wrong guess costs you the amount of the guessed number. Your goal is to minimize the total cost while guaranteeing a win. If you run out of money, you lose the game.
A wiggle subsequence is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with one element and a sequence with two non-equal elements are trivially wiggle sequences. Given an integer array nums, return the length of the longest wiggle subsequence of nums.