Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Short solution in Clear category for [old] Number Base by SaintDron
"use strict";
var numberRadix = (s, r) => parseInt([...s].sort().pop(), r) ? parseInt(s, r) : -1;
var assert = require('assert');
if (!global.is_checking) {
assert.equal(numberRadix("AF", 16), 175, "Hex");
assert.equal(numberRadix("101", 2), 5, "Bin");
assert.equal(numberRadix("101", 5), 26, "5 base");
assert.equal(numberRadix("Z", 36), 35, "Z base");
assert.equal(numberRadix("AB", 10), -1, "B > A > 10");
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
Aug. 21, 2018
Comments: