Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.
Example:
Given a = 1 and b = 2, return 3.
...
admin
4年前 (2016-10-08) 1112℃ 0评论
0喜欢
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.
Note:
1All letters...
admin
4年前 (2016-10-07) 1023℃ 0评论
0喜欢
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those le...
admin
4年前 (2016-10-07) 1241℃ 0评论
0喜欢
Find the sum of all left leaves in a given binary tree.
Example:
3
/ \
9 20
/ \
15 7
There are two left leaves in the bi...
admin
4年前 (2016-10-07) 1057℃ 0评论
0喜欢
有一个数组a[N]顺序存放0~N-1,要求每隔两个数删掉一个数,到末尾时循环至开头继续进行,求最后一个被删掉的数的原始下标位置。以8个数(N=7)为例:{0,1,2,3,4,5,6,7},0->1->2(删除)->3->4->5(删除)->6->7->0(删除),如此循环直到最后...
admin
5年前 (2016-09-06) 1329℃ 0评论
1喜欢
题目:
有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
代码:
# author=lee
# date=2016.5.26
def getAnswer():
for i in range(1,5):
...
admin
5年前 (2016-05-26) 1165℃ 0评论
0喜欢
问题描述:
算法思想:
代码实现:
#include <iostream>
using namespace std;
class Loading
{
public:
void getBest();
private:
void ...
admin
5年前 (2016-01-07) 8922℃ 0评论
0喜欢
问题描述:
算法思想:
代码实现:
#include <iostream>
using namespace std;
class Queen
{
friend int nQueen(int);//求解八皇后
private:
...
admin
5年前 (2016-01-07) 5082℃ 0评论
0喜欢
问题描述:
算法思想:
代码实现:
/*
测试数据:
n = 5
packageWeight = 10
weight = {2,2,6,5,4}
value = {6,3,5,4,6}
*/
#include <iostream>
#inclu...
admin
5年前 (2016-01-07) 8710℃ 0评论
9喜欢
问题描述:
算法描述:
代码:
#include &lt;iostream&gt;
using namespace std;
class Player
{
public:
Player(int n)
{
...
admin
5年前 (2016-01-07) 4968℃ 0评论
2喜欢