题目描述:
Given an integer array nums
, return the number of range sums that lie in [lower, upper]
inclusive.
Range sum S(i, j)
is defined as the sum of the elements in nums
between indices i
and j
(i
≤ ...
最后更新于 .
Given an integer array nums
, return the number of range sums that lie in [lower, upper]
inclusive.
Range sum S(i, j)
is defined as the sum of the elements in nums
between indices i
and j
(i
≤ ...
最后更新于 .
Given an integer, write a function to determine if it is a power of three.
Follow up:
Could you do it without using any loop / recursion?
给定一个整数,编写函数判断它是否是3的幂。
进一步思考:
你可以不用循环/递归解出本题吗?
解法I:求对数,然后乘方,判断得数是否相等
class ...
最后更新于 .
Given a binary tree containing digits from 0-9
only, each root-to-leaf path could represent a number.
An example is the root-to-leaf path 1->2->3
which represents the number 123
.
Find the total sum of all root-to-leaf numbers.
For example,
1 ...
最后更新于 .
Given an unsorted array nums
, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]...
.
Example:
(1) Given nums = [1, 5, 1, 1, 6, 4]
, one possible answer is [1, 4, 1, 5, 1 ...
最后更新于 .
You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be ...