Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

60%
+1 −0
Challenges Presumptuous base conversion

JavaScript, 73 71 63 53 52 bytes Well, this ain't pretty at all! Will need to take another pass over it to try to improve upon it, maybe with recursion.Yeah, I was completely overthinking this one...

posted 1y ago by Shaggy‭  ·  edited 1y ago by Shaggy‭

Answer
#8: Post edited by user avatar Shaggy‭ · 2022-09-20T15:21:19Z (over 1 year ago)
  • # JavaScript, <s>73</s> <s>71</s> <s>63</s> 53 bytes
  • <s>Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.</s><br>Yeah, I was _completely_ overthinking this one!
  • <!-- language-all: lang-javascript -->
  • s=>parseInt(s,-~`0x${[...s].sort().pop()}`)||s.length
  • [Try it online!](https://tio.run/##BcFJCoAwDADAv4iHBDQI6lHvvkEEi9aN0pSmiODy9TpzqFPJ5HcXcsuzjksTpWmd8qI7G0Cy/BuLK717IpKBhH0AJMcO8B3xeYSMtmvY4sRW2GgyvMICSVWXCWL8AQ)
  • # JavaScript, <s>73</s> <s>71</s> <s>63</s> <s>53</s> 52 bytes
  • <s>Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.</s><br>Yeah, I was _completely_ overthinking this one!
  • <!-- language-all: lang-javascript -->
  • s=>parseInt(s,`0x`+[...s].sort().pop()-~0)||s.length
  • [Try it online!](https://tio.run/##Dc6xasMwFIXhvU@RUcInlyu5qZNB3jp07lgKupHtJMVYwhLFQ@iru9oOP99wfuRXclgfqRyXOIz75Pbs@iRrHj@WojI8b775IqL8TTmuRWlKMSl9/GP9fGaax@VW7rs4zzC4QDBiAjPYwNRkwBaWYS3eTrhUILieK6iCKxwYoW5jW8g1oOs6vJ5aTznNj@LhX4SmuL5LuKvN9SEuOc4jzfGmNkoyfBapn1rd@IPrD76Z1Ka13v8B) (Includes all test cases)
#7: Post edited by user avatar Shaggy‭ · 2022-09-20T15:00:40Z (over 1 year ago)
  • # JavaScript, <s>73</s> <s>71</s> 63 bytes
  • <s>Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.</s><br>Yeah, I was _completely_ overthinking this one!
  • <!-- language-all: lang-javascript -->
  • s=>parseInt(s,-~Math.max(...[...s].map(x=>`0x${x}`)))||s.length
  • [Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/Y1q4gsag41TOvRKNYR7fON7EkQy83sUJDT08vGoiLY4G8Ao0KW7sEgwqV6oraBE1NzZqaYr2c1Lz0koz/yfl5xfk5qXo5@ekaaRpKJqbGSpqa/wE)
  • # JavaScript, <s>73</s> <s>71</s> <s>63</s> 53 bytes
  • <s>Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.</s><br>Yeah, I was _completely_ overthinking this one!
  • <!-- language-all: lang-javascript -->
  • s=>parseInt(s,-~`0x${[...s].sort().pop()}`)||s.length
  • [Try it online!](https://tio.run/##BcFJCoAwDADAv4iHBDQI6lHvvkEEi9aN0pSmiODy9TpzqFPJ5HcXcsuzjksTpWmd8qI7G0Cy/BuLK717IpKBhH0AJMcO8B3xeYSMtmvY4sRW2GgyvMICSVWXCWL8AQ)
#6: Post edited by user avatar Shaggy‭ · 2022-09-20T14:58:44Z (over 1 year ago)
  • # JavaScript, 71 bytes
  • Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.
  • <!-- language-all: lang-javascript -->
  • a=>a.map(x=>n=n*-~Math.max(...b=a.map(x=>+`0x${x}`))+b[y++],n=y=0)|n||y
  • [Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/R1i5RLzexQKPC1i7PNk9Lt843sSQDKFKhoaenl2QLl9ROMKhQqa6oTdDU1E6KrtTWjtXJs620NdCsyaupqfyfnJ9XnJ@TqpeTn66RphEN1KtkYmqsFKup@R8A)
  • # JavaScript, <s>73</s> <s>71</s> 63 bytes
  • <s>Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.</s><br>Yeah, I was _completely_ overthinking this one!
  • <!-- language-all: lang-javascript -->
  • s=>parseInt(s,-~Math.max(...[...s].map(x=>`0x${x}`)))||s.length
  • [Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/Y1q4gsag41TOvRKNYR7fON7EkQy83sUJDT08vGoiLY4G8Ao0KW7sEgwqV6oraBE1NzZqaYr2c1Lz0koz/yfl5xfk5qXo5@ekaaRpKJqbGSpqa/wE)
#5: Post edited by user avatar Shaggy‭ · 2022-09-20T14:17:25Z (over 1 year ago)
  • # JavaScript, 73 bytes
  • Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.
  • <!-- language-all: lang-javascript -->
  • a=>a.map(x=>~~`0x${x}`).reduce((n,x,_,a)=>x+n*-~Math.max(...a))||a.length
  • [Try it online!](https://tio.run/##DcpBDoIwEADAvxAPu1o2Juqx/QEvMEY2pYCmtgSq2UTs1yvnmSd/eLHzY0p1iJ0rvS6sDdOLJxBtcm6PsvvKr0WaXfe2DiAoUXfFqI0cwr7ODadx@wJExIjryuRdGNJYbAxL9I58HKCH6@bV@XKqbojlDw)
  • # JavaScript, 71 bytes
  • Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.
  • <!-- language-all: lang-javascript -->
  • a=>a.map(x=>n=n*-~Math.max(...b=a.map(x=>+`0x${x}`))+b[y++],n=y=0)|n||y
  • [Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/R1i5RLzexQKPC1i7PNk9Lt843sSQDKFKhoaenl2QLl9ROMKhQqa6oTdDU1E6KrtTWjtXJs620NdCsyaupqfyfnJ9XnJ@TqpeTn66RphEN1KtkYmqsFKup@R8A)
#4: Post undeleted by user avatar Shaggy‭ · 2022-09-20T13:43:52Z (over 1 year ago)
#3: Post edited by user avatar Shaggy‭ · 2022-09-20T13:43:40Z (over 1 year ago)
  • # JavaScript, 65 bytes
  • Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.
  • <!-- language-all: lang-javascript -->
  • a=>a.map(x=>~~`0x${x}`).reduce((n,x,_,a)=>x+n*-~Math.max(...a))|1
  • [Try it online!](https://tio.run/##DcpLDoIwEADQuxAXM1omGmXZ3sATGAKTUlQCLeGXSdRevbJ9eR1vPNvpPS65D41LrU6sDdPAI4g2MdZnOXzkVyNNrlmtA/BKVKUYtZGTP@bxzstr/wJExIjfS7LBz6F31IcntPDYPbsV16xETH8)
  • # JavaScript, 73 bytes
  • Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.
  • <!-- language-all: lang-javascript -->
  • a=>a.map(x=>~~`0x${x}`).reduce((n,x,_,a)=>x+n*-~Math.max(...a))||a.length
  • [Try it online!](https://tio.run/##DcpBDoIwEADAvxAPu1o2Juqx/QEvMEY2pYCmtgSq2UTs1yvnmSd/eLHzY0p1iJ0rvS6sDdOLJxBtcm6PsvvKr0WaXfe2DiAoUXfFqI0cwr7ODadx@wJExIjryuRdGNJYbAxL9I58HKCH6@bV@XKqbojlDw)
#2: Post deleted by user avatar Shaggy‭ · 2022-09-20T12:11:47Z (over 1 year ago)
#1: Initial revision by user avatar Shaggy‭ · 2022-09-20T12:10:31Z (over 1 year ago)
# JavaScript, 65 bytes

Well, this ain't pretty _at all_! Will need to take another pass over it to try to improve upon it, maybe with recursion.

<!-- language-all: lang-javascript -->

    a=>a.map(x=>~~`0x${x}`).reduce((n,x,_,a)=>x+n*-~Math.max(...a))|1

[Try it online!](https://tio.run/##DcpLDoIwEADQuxAXM1omGmXZ3sATGAKTUlQCLeGXSdRevbJ9eR1vPNvpPS65D41LrU6sDdPAI4g2MdZnOXzkVyNNrlmtA/BKVKUYtZGTP@bxzstr/wJExIjfS7LBz6F31IcntPDYPbsV16xETH8)