New answers tagged code-challenge
0
votes
0
votes
Without using numbers, get the highest salary you can. But don't exaggerate!
Zsh, $138166 (14 bytes)
<<<\$$[##𡮶]
Attempt This Online!
𡮶 is the Unicode character with codepoint 138166. This is the maximum integer score for 14 bytes.
0
votes
Without using numbers, get the highest salary you can. But don't exaggerate!
Vyxal ṡ, 6 bytes, $260847
\$»⟑¬ǎ
Try it Online!
2
votes
1
vote
Count /[^a-z]/ig with /[a-z]/ig
Brev, score 13
((fn (string-length (strse x 'alpha ""))) "(fn(string-length(strse x 'alpha \"\")))")
1
vote
2
votes
Implement the slowest possible sorting algorithm that retains a fast best case
Python 3, \$O\left(n^2\left(max\left(a\right)-min\left(a\right)+1\right)^{n-1}\right)\$
...
1
vote
1
vote
2
votes
2
votes
1
vote
2
votes
Write the shortest program that generates the most compiler warnings and errors
Rust, 206 chars, 220+2 errors, score 5090, tunable.
...
4
votes
Big big numbers
Vyxal, 3 bytes ~\$10^{305}\$
øCṪ
Try it Online!
Thanks to emanresu A for 2 more orders of magnitude
Simple number compression builtin, then chop off the last char. ...
1
vote
Count /[^a-z]/ig with /[a-z]/ig
Ruby, score 5, 67 bytes
p gets.count"^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Attempt This Online!
2
votes
Count /[^a-z]/ig with /[a-z]/ig
BQN, Score: 8, 60 bytes
+´¬∘∊⟜"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Try it here!
Thanks to @thejonymyster for helping halve the score!......
3
votes
1
vote
12 with no 1234567890, but polyglot
JavaScript (jsshell), Python 3, bash (core utils)?, brainfuck, 109 bytes
...
2
votes
12 with no 1234567890, but polyglot
brainfuck, Headass, Javascript; 3 languages, 52 bytes
print("+++++++^[>D+++++P++<-]>:".length/"+?".length)
Three cussword titled ...
2
votes
1
vote
Count /[^a-z]/ig with /[a-z]/ig
Ruby, Score: 24, 42 bytes
->s{s.chars.map{_1=~/[A-Za-z]/?0:1}.sum-1}
Attempt This Online!
There is a -1 the end due to the \n.
If you don't coun't it, it's 40 bytes and Score: 22
2
votes
12 with no 1234567890, but polyglot
6+ languages, 24 bytes, score < 0.67
Haskell, OCaml, Coq, Common Lisp, Erlang, Octave/Matlab, and many other functional languages
...
3
votes
12 with no 1234567890, but polyglot
5 Languages - Keg, Vyxal, Python 3, 05AB1E and Curlyfrick, 114 bytes
...
0
votes
12 with no 1234567890, but polyglot
Example Submission, \$1\$ Language(s), \$26\$ Byte(s), Score \$\frac{26}{1^2}=26\$.
Language(s):
Python
print(len('aaaaaaaaaaaa'))
Explanation
Need I say more...?...
2
votes
2
votes
2
votes
3
votes
2
votes
2
votes
2
votes
3
votes
3
votes
4
votes
Write Moby Dick, approximately
sh+bzip3, 2*321,287+0 = 642574
Based on this submission - except bzip3 manages to get a substantially better compression ratio. Building the file:
...
3
votes
2
votes
Count /[^a-z]/ig with /[a-z]/ig
APL (NARS2000) Score 19, 31 bytes
{≢⍵~⎕av[C,32+C←66..91]}
Examples
{≢⍵~⎕av[C,32+C←66..91]} 'Hello, World!' evaluates to ...
2
votes
3
votes
Count /[^a-z]/ig with /[a-z]/ig
Python 2, score 9, 40 bytes
lambda s:map(str.isalpha,s).count(False)
Try it online!
6
votes
Count /[^a-z]/ig with /[a-z]/ig
CJam, score 0, 95 89 82 bytes
qeuWcibWcibKAbFbAbHbAbIbfbXfbKBbKbAbDbAbKbfbKYbKbYbCbfbXdfmdUfmOGYbCbfbUfbXfbUfbXb
Try it.
Explanations
...
3
votes
Count /[^a-z]/ig with /[a-z]/ig
Alumin, Score 0 (82 bytes)
iqipkmddhhdtddtthaueyddhhhdtdhatveyddhhhhhhhdthhthcueydhhhdhathcdthavetrtahycmzfaf
Try it online! I thought this would be a funny ...
3
votes
Count /[^a-z]/ig with /[a-z]/ig
Wolfram Language (Mathematica), score 4, 40 bytes
ss~StringCount~Except@LetterCharacter
Try it online!
3
votes
Count /[^a-z]/ig with /[a-z]/ig
PowerShell Core, 59 bytes, score: 8 10
$input-replace"[abcdefghijklmnopqrstuvwxyz]"|foreach Length
Try it online!
-2 bytes thanks to user314159
1
vote
Write a polyglot that prints the language's name
PE/bash/x86/C/Ruby/Python2, 330 bytes
score ≈ 0.0445
xxd:
...
5
votes
Count /[^a-z]/ig with /[a-z]/ig
Jelly, score 3, 4 bytes
@caird-coinheringaahing saves 1 byte!
ḟØẠL
Attempt This Online!
Explanation:
Filter alphabetic characters from input, then return length
6
votes
Count /[^a-z]/ig with /[a-z]/ig
JavaScript (in Browser), Score 4, 120 bytes
eval(atob`ZXZhbCgicyAgPSIrICAiPnMubWEiKyAidGNoKCIrICIvWyIrICAiXmEtekEtWiIrICJdLyIrImcpPyIrICIubCIrImVuZyIrInRoIHwgMCIp`)
...
4
votes
Count /[^a-z]/ig with /[a-z]/ig
Perl 5 + -n0 -M5.10.0, Score: 3, 14 bytes
say s M\PlMMig
Try it online!
3
votes
Count /[^a-z]/ig with /[a-z]/ig
C# (Visual C# Interactive Compiler), 11 Score, 32 bytes
s=>s.Count(c=>!char.IsLetter(c))
Try it online!
4
votes
Count /[^a-z]/ig with /[a-z]/ig
Rust, score 14, 42 bytes
|s|s.replace(char::is_alphabetic,"").len()
Attempt This Online!
Only works for ASCII inputs, because ...
4
votes
Count /[^a-z]/ig with /[a-z]/ig
Wolfram Language (Mathematica), score 5, 39 bytes
sStringLength@s-Total@LetterCounts@s
Try it online!
Doesn't work if the input contains non-ASCII letters (e.g. <...
10
votes
Count /[^a-z]/ig with /[a-z]/ig
Charcoal -v, 36 bytes, score 0
CastLengthFilterqNotCountaUppercasei
Try it online! Explanation: Charcoal's verbose parser is somewhat lax, not always requiring ...
Top 50 recent answers are included
Related Tags
code-challenge × 879math × 74
restricted-source × 69
string × 65
optimization × 54
source-layout × 46
number × 44
quine × 42
polyglot × 38
compression × 37
kolmogorov-complexity × 35
game × 33
test-battery × 31
busy-beaver × 29
code-golf × 28
sequence × 28
primes × 25
ascii-art × 23
code-generation × 23
fastest-code × 22
cops-and-robbers × 22
combinatorics × 21
graphical-output × 21
sorting × 18
image-processing × 17