Description Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak. <! more Analysis 一道矩阵背景下的简单sumdiv,同样是两种算法。 等比数列 an ...
分类:
其他好文 时间:
2018-09-14 01:07:02
阅读次数:
256
题目: We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. 我们定义Perfect Number是一个正整数,它 ...
分类:
其他好文 时间:
2018-09-12 21:10:02
阅读次数:
174
You are given two positive integer numbers a and b. Permute (change order) of the digits of a to construct maximal number not exceeding b. No number i ...
分类:
其他好文 时间:
2018-09-12 14:04:29
阅读次数:
176
Given a 2D matrix containing all positive and distinct integers in the range [1, N^2], compute the longest path containing consecutive integers in thi ...
分类:
其他好文 时间:
2018-09-11 16:11:19
阅读次数:
126
题目描述 给定一个未排序的整数数组,找出其中没有出现的最小的正整数。 示例 1: 示例 2: 示例 3: 说明: 你的算法的时间复杂度应为O(n),并且只能使用常数级别的空间。 解题思路 本题让只能使用常数级别的空间,所以哈希的解法只能放弃了。考虑另一种思路,把数字依次放到他们对应的位置上,比如1放 ...
分类:
其他好文 时间:
2018-09-11 13:57:51
阅读次数:
235
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a ...
分类:
其他好文 时间:
2018-09-07 22:04:20
阅读次数:
167
真是棒棒哒!!!深圳地铁prince,你听到了吗???(PS:犯什么呆萌?还不滚去刷题?) The task of this problem is simple: insert a sequence of distinct positive integers into a hash table fi ...
分类:
其他好文 时间:
2018-09-07 19:17:42
阅读次数:
201
题目描述: Given two positive integers a and b,find suitable X and Y to meet the conditions: X+Y=a Least Common Multiple (X, Y) =b Input Input includes mul ...
分类:
其他好文 时间:
2018-09-06 02:55:36
阅读次数:
177
[LeetCode 41] First Missing Positive 题目 测试案例 思路 从左往右遍历每一个元素 如果 nums[i] = i + 1 或者 nums[i] 的值在 1 ~ n 范围之外,遍历下一个元素。 否则,应该将 nums[i] 放到下标 nums[i] 1 处,如果此下 ...
分类:
编程语言 时间:
2018-09-05 17:32:51
阅读次数:
180
The K?P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program t ...
分类:
其他好文 时间:
2018-09-04 17:09:08
阅读次数:
177