Skip to main content
4 votes

Check if two lists are permutations of each other

Haskell, 26 bytes (.g).(==).g g=sum.map(65^) Try it online! 27 bytes g=sum.map(65^) a%b=g a==g b Try it online! Converts the ...
xnor's user avatar
  • 146k
3 votes

Check if two lists are permutations of each other

Vyxal 3, 3 bytes ᵛS≈ Try it Online! I haven't golfed in forever. ...
Seggan's user avatar
  • 5,407
3 votes

Check if two lists are permutations of each other

JavaScript (ES6), 27 bytes Expects (a)(b) and returns a Boolean value. a=>b=>a.sort()+""==b.sort() Try it ...
Arnauld's user avatar
  • 194k
2 votes

Check if two lists are permutations of each other

Python 3.8 (pre-release),  21  31 bytes +10 bytes due to a bug regarding duplicate items, thanks to chunes. lambda a,b:sorted(a)==sorted(b) Try it online! ...
squareroot12621's user avatar
2 votes

Check if two lists are permutations of each other

Jelly, 2 bytes œ^ Try it online! Inverted truthy/falsy (with the non vectorizing logical not monad in the footer to ...
Unrelated String's user avatar
2 votes
Accepted

Check if two lists are permutations of each other

Brachylog, 1 byte p Try it online! Yep, that's just one builtin. Brachylog works in terms of (generally) bidirectional relationships between variables, with two ...
Unrelated String's user avatar
2 votes

Check if two lists are permutations of each other

NARS2000, 2 bytes ≡⍦ Multiset match: are the two arguments equivalent when treated as multisets? This checks that the elements are both the same and have the same ...
RubenVerg's user avatar
  • 862
2 votes

Check if two lists are permutations of each other

Uiua, 6 7 bytes -1 thanks to ovs ≍∩⊏∩⊸⍏ try it! ...
nyxbird's user avatar
  • 363
1 vote

Check if two lists are permutations of each other

Julia 1.0, 16 bytes A*B=A∪B==A∩B Try it online! Checks if the union and intersections of both lists are equal. A 17-byte solution is possible without Unicode, ...
Ashlin Harris's user avatar
1 vote

Check if two lists are permutations of each other

Google Sheets, 34 bytes =sort(min(n(sort(A:A)=sort(B:B)))) Put the first list in column A1:A, the second list in ...
doubleunary's user avatar
  • 1,875
1 vote

Determine whether strings are anagrams

R, 45 39 36 bytes Edit: -9 bytes thanks to @Dominic van Essen. \(x,y)identical(table(x),table(x=y)) Attempt This Online! Takes input as two character vectors.
pajonk's user avatar
  • 17.2k

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