您的位置:首页 > 其它

[leetcode]504. Base 7

2017-02-19 09:39 387 查看
Given an integer, return its base 7 string representation.

Example 1:

Input: 100
Output: "202"

Example 2:

Input: -7
Output: "-10"

Note:The input will be in range of [-1e7, 1e7].

Answer:

public String convertToBase7(int num) {
return Long.toString(Long.valueOf(num),7);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: