Category: c / c++
Given a non-negative integer c, your task is to decide whether there’re two integers a and b such that a^2 + b^2 = c. Example 1: Input: 5 Output: …
The Catalan number as described here is one of the well-known combinatorial number that has quite a few applications. For example, C(n) can be used to count the number …
Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B. Example …
We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write a …
Given an array A of 0s and 1s, consider N_i: the i-th subarray from A to A interpreted as a binary number (from most-significant-bit to least-significant-bit.) Return a list …