Tag: math
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. The given integer is guaranteed to fit within the …
On a N * N grid, we place some 1 * 1 * 1 cubes that are axis-aligned with the x, y, and z axes. Each value v = …
Given an array that has n integers, find a sub array of given length k that has the maximum average value. Write a function that outputs the maximum average …
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left …
You have a list of points in the plane. Return the area of the largest triangle that can be formed by any 3 of the points. Example: Input: points …