- 博客(3)
- 资源 (1)
- 收藏
- 关注
原创 Swap Nodes in Pairs LeetCode
Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space. Y
2015-09-19 15:31:22 154
原创 LeetCode Contains Duplicate C
题目:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every eleme
2015-09-17 21:53:14 185
原创 素数对猜想
让我们定义 dn 为:dn = pn+1 - pn,其中 pi 是第i个素数。显然有 d1=1 且对于n>1有 dn 是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。 现给定任意正整数N (5),请计算不超过N的满足猜想的素数对的个数。 输入格式:每个测试输入包含1个测试用例,给出正整数N。 输出格式:每个测试用例的输出占一行,不超过N的满足猜想的素数对的个数。 输入样例:20 输出
2015-04-23 16:41:33 165
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人