504.七进位数(javascript)504.Base7

原创
小哥 3年前 (2022-11-10) 阅读数 2 #大杂烩

给定一个整数 num,改造它 7 并输出为字符串。

Given an integer num, return a string of its base 7 representation.

示例 1:

输入: num = 100
输出: "202"

示例 2:

输入: num = -7
输出: "-10"

var convertToBase7 = function(num) {
    return num.toString(7)
};

这个话题没有限制,不要觉得太复杂

javascript二进制和二进制之间的转换。

leetcode: https://leetcode-cn.com/problems/base-7/

版权声明

所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除