leetcode 504. Base 7
2017-03-09 16:14
281 查看
public class Solution { public String convertToBase7(int num) { if (num == 0) return "0"; String res = ""; int temp = num; int remainder = temp % 7; while (temp!=0) { res = String.valueOf(Math.abs(remainder)) + res; temp /= 7; remainder = temp % 7; } if (num < 0 ) res = "-" + res; return res; } }
相关文章推荐
- leetcode 504. Base 7
- (Leetcode)504. Base 7
- [LeetCode] 504. Base 7 ❤
- leetcode 504. Base 7 python
- [leetCode刷题笔记]504. Base 7
- 【Leetcode】504. Base 7
- LeetCode504. Base 7 我是如何解答的
- 【LeetCode】 504. Base 7
- leetcode 504. Base 7(easy)
- leetcode 504. Base 7
- LeetCode-504. Base 7 (Java)
- LeetCode 504. Base 7
- [LeetCode]504. Base 7
- [LeetCode]504. Base 7(七进制)
- leetcode:504. Base 7
- [Leetcode] 504. Base 7 解题报告
- [leetcode]504. Base 7
- 【LeetCode】504. Base 7【E】【94】
- leetcode 504. Base 7 转换七进制
- LeetCode 504. Base 7