We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
设定如下的对应关系(A=1,B=2,C=3,...,Z=26,AA=27,AB=28,....AZ=, BA=, .....AAA=, ...),编写一个转换函数,根据上面的规则把一个字符串: "WECHAT" 转换为数字。 其实没有很好的计算机基础知识很难发现这是一道进制转换的题,如果发现不了这道题就没法解。 利用进制转换的公式:
function rule(s) { let sum = 0; for (let i = s.length - 1; i >=0; i--) { sum += (s.charCodeAt(i) - 65 + 1) * Math.pow(26, s.length - i - 1); } return sum; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
设定如下的对应关系(A=1,B=2,C=3,...,Z=26,AA=27,AB=28,....AZ=, BA=, .....AAA=, ...),编写一个转换函数,根据上面的规则把一个字符串: "WECHAT" 转换为数字。
其实没有很好的计算机基础知识很难发现这是一道进制转换的题,如果发现不了这道题就没法解。
利用进制转换的公式:
The text was updated successfully, but these errors were encountered: