Hot answers tagged

168 votes

Count of "a"s and "b"s must be equal. Did you get it computer?

Python 3, 32 bytes eval(input().translate(")("*50)) Try it online! Outputs via exit code: Error for false, no error for True. The string is evaluated as ...
xnor's user avatar
  • 145k
130 votes

Translate oOo CODE

oOo, 1569 1515 bytes Had to be done. Try it here. Golfed: ...
nneonneo's user avatar
  • 12.3k
41 votes

r flag my Vyxal

05AB1E, 15 12 10 9 bytes -1 byte thanks to Kevin Cruijssen! This could be 8 bytes without the l, but why would I remove that? ...
ovs's user avatar
  • 59k
36 votes
Accepted

Count of "a"s and "b"s must be equal. Did you get it computer?

MATL, 5 4 bytes tSP- Prints a non-empty array of 1s if the string belongs to L, and an empty array or an array with 0s (both falsy) otherwise. Thanks to @...
Dennis's user avatar
  • 210k
28 votes

Expand a C array

Vim, 54, 52, 49 47 keystrokes 2wa0<esc>qqYp<c-a>6ldf @qq@q$dT]dd:%norm dwf{xwC;<CR>gg"0P Explanation: ...
DJMcMayhem's user avatar
28 votes

Count of "a"s and "b"s must be equal. Did you get it computer?

Retina, 12 bytes Credits to FryAmTheEggman who found this solution independently. +`a;?b ; ^;$ Prints 1 for valid input and <...
Martin Ender's user avatar
28 votes
Accepted

Generate Pyramid Scheme code

Common Lisp - 2524 1890 bytes ...
Neil Lindquist's user avatar
26 votes

Count of "a"s and "b"s must be equal. Did you get it computer?

Haskell, 31 bytes f s=s==[c|c<-"ab",'a'<-s]&&s>"" The list comprehension ...
xnor's user avatar
  • 145k
26 votes

Maintain Social Distancing!

Python 2 with SciPy, 105 101 99 bytes -1 byte thanks to @vroomfondel ! ...
Surculose Sputum's user avatar
25 votes

Can Jimmy hang on his rope?

Python 2 or 3,  33  30 bytes -3 thanks to Maxwell lambda l:'o'in map(max,l[:-1]) An unnamed function accepting a list of lines Try it online! How? ...
Jonathan Allan's user avatar
24 votes

Parse a C++14 integer literal

x86 (32-bit) machine code, 59 57 bytes This function takes esi as a pointer to a null-terminated string and returns the value in ...
Daniel Schepler's user avatar
22 votes

Compare two numbers given as strings

Javascript, 11 bytes a=>b=>+a==b Abusing Javascript's casting rules a bit; +a coerces ...
elementbound's user avatar
22 votes

Ungolf my tinylisp code

tinylisp, 1022 bytes ...
emanresu A's user avatar
  • 37.2k
21 votes

Read out the C variable declaration

Python 3, 331 312 294 261 240 bytes ...
Kateba's user avatar
  • 1,252
20 votes

Compare two numbers given as strings

05AB1E, 1 byte Q Try it online! Explanation Comparison for equality Q will automatically try to evaluate strings as ints ...
Emigna's user avatar
  • 52.9k
20 votes

Compare two numbers given as strings

Operation Flashpoint scripting language, 33 bytes f={call format(["%1==%2"]+_this)} Call with: ...
Steadybox's user avatar
  • 16.5k
19 votes

Parse a lambda for correctness

Perl 5 -p, 86 bytes Who said this can’t be solved with a regex? ☺ ...
Anders Kaseorg's user avatar
18 votes

Count of "a"s and "b"s must be equal. Did you get it computer?

Grime, 12 bytes A=\aA?\b e`A Try it online! Explanation The first line defines a nonterminal A, which matches one letter <...
Zgarb's user avatar
  • 42.6k
18 votes
Accepted

Parse the comments out of my esoteric code

Jelly, 8 7 bytes »/ṣ”#ḢṖ Try it online! How it works ...
Dennis's user avatar
  • 210k
18 votes

Create a Boolean Calculator

Python, 3 bytes ÷ 1 op = score 3 min Try it online! Implements AND, with inputs like ...
xnor's user avatar
  • 145k
17 votes

Read out the C variable declaration

Retina 0.8.2, 142 138 128 117 bytes (\w+) (.+); ($2) $1 \(\) function returning \[(\d+)?] array of$#1$* $1 +`\((\**)(.+)\) $2$1 \* pointer to 1` is Try it ...
Neil's user avatar
  • 169k
17 votes

Can Jimmy hang on his rope?

Python 2, 28 bytes lambda x:"o', '|"in`zip(*x)` Try it online! How does it work? It takes input as a list of strings, and zip joins the string. Jimmy stays on ...
mprogrammer's user avatar
17 votes
Accepted

Can Jimmy hang on his rope?

Japt, 5 bytes I think this is right; I've been working for 16 hours straight and barely know my own name so I wouldn't be surprised if it's not! Õø|io Try it ...
Shaggy's user avatar
  • 41.7k
17 votes

Write a C++ demangler

C (gcc), 267 ... 222 221 bytes -30 bytes thanks to @EasyasPi -8 more bytes thanks to @EasyasPi and @ceilingcat -1 more byte thanks to @ceilingcat ...
a stone arachnid's user avatar
17 votes

How many values of this type?

Proton, 80 bytes Never,Unit,Bool,Order=0..4 Option=(1+) Either=(+) Pair=(*) Func=(x,y)=>y**x eval Try it online! This solution is a whole lot shorter in Proton. ...
hyper-neutrino's user avatar
  • 41.4k
16 votes

What's the Language?

Bash, 100%, 100 bytes sed sX..s.2./s.XX|grep -Po '(?<=>)[^<]+?(?=(,(?! W)| [-&–5]| ?<| [0-79]\d| ?\((?!E|1\.)))'|head -1 Try it online on Ideone. ...
Dennis's user avatar
  • 210k
16 votes
Accepted

Remove unnecessary parentheses

Mathematica, 105 97 91 bytes -6 bytes thanks to Roman! a=StringReplace;ToString@ToExpression@a[#,{"*"->"**","+"->"~~"}]~a~{" ** "->"*","~~"->"+"}& ...
LegionMammal978's user avatar
16 votes

Golf my Shakespeare quote references

The Shakespeare Programming Language (non-competing) I really liked this question, and as there was some interest in a Shakespeare-language answer, here is one. ...
ShreevatsaR's user avatar
  • 1,085
16 votes

Logical Order of Operations

Japt, 15 bytes OvUr" +%d"_rS'( Test it online! How it works This challenge was practically made for Japt. I shall attempt to explain how: Japt is basically a ...
ETHproductions's user avatar
16 votes
Accepted

Parse a Unicode vulgar fraction

Raku, 17 bytes {S!\⅟!1/!.EVAL} Try it online! Returns a rational number type. Raku actually natively supports unicode literals and operators, though it doesn't ...
Jo King's user avatar
  • 47.1k

Only top scored, non community-wiki answers of a minimum length are eligible