# Leetcode Convert a Number to Hexadeci

class Solution {
public:
string toHex(int num) {
string re;
if(num == 0) re += '0';
while(num) {
int temp = num & 15;
if(temp > 9) {
re += temp - 10 + 'a';
}
else re += temp + '0';
num >>= 4;
if(num < 0) num &= 0x0fffffff;
}

std::reverse(re.begin(), re.end());
return re;
}
};

#### 【LeetCode】405 Convert a Number to Hexadecimal （java实现）

2016-11-09 23:33:12

#### LeetCode 405. Convert a Number to Hexadecimal 解题报告

2016-09-27 13:48:47

#### leetcode python - String to Integer (atoi)

2017-04-05 15:37:20

#### Leetcode405. Convert a Number to Hexadecimal十进制转十六进制

2016-09-26 22:06:03

#### 【LeetCode】Integer to Roman 和 Roman to Integer 解题报告

2014-10-10 20:28:24

#### 【LeetCode】ZigZag Conversion 解题报告

2014-10-26 16:49:26

#### [LeetCode]405. Convert a Number to Hexadecimal(32位有符号整数转化为十六进制)

2017-05-31 00:11:47

#### 【LeetCode】String to Integer (atoi) 解题报告

2014-10-27 16:19:38

#### [leetcode] 17. Letter Combinations of a Phone Number ,python实现【medium】

2016-06-14 22:25:54

#### LeetCode | 754. Reach a Number 数学原理题解析与证明

2018-01-02 13:34:07