Hot answers tagged

57 votes
Accepted

Vertically collapse text

Pyth, 10 bytes jb_.T.T_.z Try it online in the Pyth Compiler/Executor. Idea We can achieve the desired output by applying four simple transformations: Reverse ...
Dennis's user avatar
  • 209k
50 votes
Accepted

Sign that word!

GolfScript, 1 byte $ Yes, only 1 byte. Try it here.
jimmy23013's user avatar
  • 36.7k
44 votes

Sort the months of the year

Jelly, 19 bytes 11ị“bMAanlseovc”iµÞ This is a monadic link that takes a list as argument and sorts it. Try it online! Background Jelly uses modular, 1-based ...
Dennis's user avatar
  • 209k
43 votes
Accepted

Lossy Sorting (Implement Dropsort)

APL, 9 bytes ⊢(/⍨)⊢=⌈\ This is a monadic function train with diagram: ┌─┼───┐ ⊢ ⍨ ┌─┼─┐ ┌─┘ ⊢ = \ / ┌─┘ ⌈ The ...
lirtosiast's user avatar
  • 21.4k
39 votes

Vertically collapse text

Haskell, 62 bytes import Data.List p=reverse;o=transpose f=unlines.p.o.o.p.lines I'm very mature.
Lynn's user avatar
  • 67.9k
38 votes

Output numbers up to 2^n-1, "sorted"

Python, 53 bytes f=lambda n,i=1:n*[f]and[i]+f(n-1,2*i)+i%2*f(n-1,i-~i) Try it online! The recursive function generates the sorted list as a pre-order walk down ...
xnor's user avatar
  • 144k
36 votes

Xorting an array

Pyth, 40 36 31 30 bytes Ju.|G^2slHxMf>FT.:Q2Z|tSIxRJQJ Try it online: Demonstration or Test Suite Each of the big test-cases finishes in a couple of seconds. ...
Jakube's user avatar
  • 21.9k
32 votes
Accepted

Find the longest word in an array

Imperative Tampio, 168 bytes ...
fergusq's user avatar
  • 5,097
27 votes
Accepted

Count My Change

Japt, 5 3 bytes ñg9 Test it online! Explanation I, too, have added a sorting function to my language in the last few weeks :-) ...
ETHproductions's user avatar
26 votes

Sign that word!

C (with x86), 61 bytes s[];main(){qsort(s,read(0,s,99),1,"YXZQQQ\x8a\x00*\x02\x0f\xbe\xc0\xc3");puts(s);} That string contains raw bytes, not actual ...
Lynn's user avatar
  • 67.9k
24 votes
Accepted

Sort an Integer List

05AB1E, 2 bytes Code: ϧ Same algorithm as the Jelly answer. Computes all permutations of the input and pops out the smallest one. Try it online! A more efficient ...
Adnan's user avatar
  • 44.2k
24 votes
Accepted

Sort the climbing grades

Python 2, 58 54 bytes lambda x:sorted(x,key=lambda y,B10=0:eval(y[1:]+'10')) Try it online! How it works ...
Lynn's user avatar
  • 67.9k
24 votes

DropSort it like it's hot

Haskell, 67 59 58 bytes (q:r)!x|x<last q=q:r!x|1<2=(q++[x]):r _!x=[[x]] foldl(!)[] Explanation: Given a list of lists (that are already sorted) and a value ...
Cristian Lupascu's user avatar
23 votes

Sort a list and write some English!

Dogescript It's basically English, right? shh oooot! my keyybr oad is brokn. i ne ed neew 1. such fixs much keys keys dose sort wow keys translates to: ...
clamchowder314's user avatar
23 votes
Accepted

Interleave strings

Jelly, 1 byte Z Try it online! The “transpose” built-in will do exactly this to a list of strings.
Lynn's user avatar
  • 67.9k
23 votes

Enumerate each series of identical numbers in-place

JavaScript (ES6), 26 bytes 1-indexed. a=>a.map(o=x=>o[x]=-~o[x]) Try it online! Commented ...
Arnauld's user avatar
  • 186k
22 votes

Sort a list and write some English!

Detour ...
Cyoce's user avatar
  • 3,311
22 votes

Lossy Sorting (Implement Dropsort)

J, 10 9 bytes #~(=>./\) Working version of my CJam idea (in fewer bytes). E.g.: ...
Martin Ender's user avatar
22 votes

Sort digits by their first occurrence in pi

Python 3, 40 39 bytes 1 byte thanks to Jonathan Allan. lambda s:sorted(s,key="145926870".find) Try it online!
Leaky Nun's user avatar
  • 49.5k
21 votes

Sort an Integer List

Jelly, 3 bytes Œ!Ṃ This generates all permutations of the input list, then selects the lexographically smallest permutation. Very efficient. Credits to @Adnan who ...
Dennis's user avatar
  • 209k
21 votes

Ordering a list

APL, 2 bytes ⍋⍋ The “grade up” built-in, applied twice. Works if indexing starts at 0, which isn’t the default for all flavors of APL. Try it here! Why does ...
Lynn's user avatar
  • 67.9k
21 votes

Pendulum Encoding

Python 3, 29 bytes lambda l:l[1::2][::-1]+l[::2] Try it online! Input: A sequence Output: The pendulum encoding of that sequence How Consider the sequence <...
Surculose Sputum's user avatar
20 votes

Sign that word!

Stuck, 4 bytes sc$d This language was documented on the wiki just yesterday! Mmm, fresh esolangs.
Lynn's user avatar
  • 67.9k
20 votes

Find the longest word in an array

Python, 23 bytes lambda a:max(a,key=len) Try it online!
Neil's user avatar
  • 2,525
20 votes

Implement the Thanos sorting algorithm

Python 3, 38 42 39 bytes q=lambda t:t>sorted(t)and q(t[::2])or t Try it online! -3 bytes thanks to @JoKing and @...
Sara J's user avatar
  • 3,725
20 votes

Integer Interpretator

Python 2, 50 bytes l=input() while l:s=set(l);print s;map(l.remove,s) Try it online! Repeatedly prints the unique of elements of the list, then removes one of ...
xnor's user avatar
  • 144k
20 votes

Help, I've mixed my week up!

Pyth, 7 bytes o%CN258 Try it online! Convert each string to a number via treating its ASCII codes as a base 256 number, then take that mod 258, and sort. This ...
isaacg's user avatar
  • 41.7k
19 votes

Sign that word!

Stuck, 5 Bytes I finally get to use my language, Stuck! :D s$""j This takes an input via stdin, sorts, joins, and implicitly prints. This did give me some ideas ...
Kade's user avatar
  • 7,842
19 votes
Accepted

List of possible birth years of living humans

Pyke, 6 bytes wC7m- Try it here! w - 121 m- - for i in range(^): C7 - current_year-i (After ...
Blue's user avatar
  • 28.5k
19 votes

Sever-sort an array

JavaScript (ES6), 64 bytes f=([n,...a],z=[],q=[n,...z])=>a+a?n<a[0]?[...q,...f(a)]:f(a,q):q Recursion FTW! The basic algorithm in use here is to keep track ...
ETHproductions's user avatar

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