Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

fixed markup
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257

JavaScript (V8), 45 bytes

(a,/*!>t*/b,m=e=>e.sort()+[],r=m(b))=>m(a)==r
a=>b=>!a.some((r,t)=>r==b[t]/*()(),,=mmer+*/)

[Try it online!][TIO-mdfoczb7]

[TIO-mdfoczb7]: https://tio.run/##jZBBboMwEEX3OYWzYoa4oHhVCQ2X6BKxGCcWoopxZJxcn5qIpDFq2q4sjd6f/8affOXx4PtzeLu@Twc3jEGcves8272gCViW@bYOeamlJUO1KUbnA@CuaaUnCxqRaguMRD6NK2KqNdVbjhFrALwMkfVEugltmQMCSknWGr/LS9xs0nJ/GQSJ2C80Cqofc2iKouBWzo9uMU2pFym1pBCWWHWv65w7xkNFk/Vs@cAhkyKLD9ues7ZaKM2voOMM3Sh3MsXJdZDNKyPwdAjE0lsRYpWycXFEtyt2rsPUUa3r7WW4HF2XOP4A2Tv0m6N6clR/OKpvR/VwfLBnHkczimCi0H71CR/B90MH9xFKkU7iunX18zq18v3fuukL "JavaScriptTry it online! (V8) – Try It Online"(improved with +[] and expecting arrayified strings, from Arnauld's solution)

Try it online!

JavaScript (V8), 56 bytes

(a,/*!>t[]*/b,m=e=>[...e].sort().join``,r=m(b))=>m(a)==r
a=>b=>![...a].some((r,t)=>r==b[t]/*()()``,,=.jmmnieor*/)

Try it online!

It's a bit unclear to me whether single-line comments (// ...)should be accepted for arrow-functions because they don't seem to be generally parsed as part of the function. I've erred on the side of caution and not used them.

JavaScript (V8), 45 bytes

(a,/*!>t*/b,m=e=>e.sort()+[],r=m(b))=>m(a)==r
a=>b=>!a.some((r,t)=>r==b[t]/*()(),,=mmer+*/)

[Try it online!][TIO-mdfoczb7]

[TIO-mdfoczb7]: https://tio.run/##jZBBboMwEEX3OYWzYoa4oHhVCQ2X6BKxGCcWoopxZJxcn5qIpDFq2q4sjd6f/8affOXx4PtzeLu@Twc3jEGcves8272gCViW@bYOeamlJUO1KUbnA@CuaaUnCxqRaguMRD6NK2KqNdVbjhFrALwMkfVEugltmQMCSknWGr/LS9xs0nJ/GQSJ2C80Cqofc2iKouBWzo9uMU2pFym1pBCWWHWv65w7xkNFk/Vs@cAhkyKLD9ues7ZaKM2voOMM3Sh3MsXJdZDNKyPwdAjE0lsRYpWycXFEtyt2rsPUUa3r7WW4HF2XOP4A2Tv0m6N6clR/OKpvR/VwfLBnHkczimCi0H71CR/B90MH9xFKkU7iunX18zq18v3fuukL "JavaScript (V8) – Try It Online"(improved with +[] and expecting arrayified strings, from Arnauld's solution)

Try it online!

JavaScript (V8), 56 bytes

(a,/*!>t[]*/b,m=e=>[...e].sort().join``,r=m(b))=>m(a)==r
a=>b=>![...a].some((r,t)=>r==b[t]/*()()``,,=.jmmnieor*/)

Try it online!

It's a bit unclear to me whether single-line comments (// ...)should be accepted for arrow-functions because they don't seem to be generally parsed as part of the function. I've erred on the side of caution and not used them.

JavaScript (V8), 45 bytes

(a,/*!>t*/b,m=e=>e.sort()+[],r=m(b))=>m(a)==r
a=>b=>!a.some((r,t)=>r==b[t]/*()(),,=mmer+*/)

Try it online! (improved with +[] and expecting arrayified strings, from Arnauld's solution)

Try it online!

JavaScript (V8), 56 bytes

(a,/*!>t[]*/b,m=e=>[...e].sort().join``,r=m(b))=>m(a)==r
a=>b=>![...a].some((r,t)=>r==b[t]/*()()``,,=.jmmnieor*/)

Try it online!

It's a bit unclear to me whether single-line comments (// ...)should be accepted for arrow-functions because they don't seem to be generally parsed as part of the function. I've erred on the side of caution and not used them.

added 789 characters in body
Source Link
Steve Bennett
  • 8.1k
  • 23
  • 74

JavaScript (V8), 45 bytes

(a,/*!>t*/b,m=e=>e.sort()+[],r=m(b))=>m(a)==r
a=>b=>!a.some((r,t)=>r==b[t]/*()(),,=mmer+*/)

[Try it online!][TIO-mdfoczb7]

[TIO-mdfoczb7]: https://tio.run/##jZBBboMwEEX3OYWzYoa4oHhVCQ2X6BKxGCcWoopxZJxcn5qIpDFq2q4sjd6f/8affOXx4PtzeLu@Twc3jEGcves8272gCViW@bYOeamlJUO1KUbnA@CuaaUnCxqRaguMRD6NK2KqNdVbjhFrALwMkfVEugltmQMCSknWGr/LS9xs0nJ/GQSJ2C80Cqofc2iKouBWzo9uMU2pFym1pBCWWHWv65w7xkNFk/Vs@cAhkyKLD9ues7ZaKM2voOMM3Sh3MsXJdZDNKyPwdAjE0lsRYpWycXFEtyt2rsPUUa3r7WW4HF2XOP4A2Tv0m6N6clR/OKpvR/VwfLBnHkczimCi0H71CR/B90MH9xFKkU7iunX18zq18v3fuukL "JavaScript (V8) – Try It Online"(improved with +[] and expecting arrayified strings, from Arnauld's solution)

Try it online!

JavaScript (V8) , 56 bytes

(a,/*!>t[]*/b,m=e=>[...e].sort().join``,r=m(b))=>m(a)==r
a=>b=>![...a].some((r,t)=>r==b[t]/*()()``,,=.jmmnieor*/)

Try it online!

It's a bit unclear to me whether single-line comments (// ...)should be accepted for arrow-functions because they don't seem to be generally parsed as part of the function. I've erred on the side of caution and not used them.

JavaScript (V8), 56 bytes

(a,/*!>t[]*/b,m=e=>[...e].sort().join``,r=m(b))=>m(a)==r
a=>b=>![...a].some((r,t)=>r==b[t]/*()()``,,=.jmmnieor*/)

Try it online!

It's a bit unclear to me whether single-line comments (// ...)should be accepted for arrow-functions because they don't seem to be generally parsed as part of the function. I've erred on the side of caution and not used them.

JavaScript (V8), 45 bytes

(a,/*!>t*/b,m=e=>e.sort()+[],r=m(b))=>m(a)==r
a=>b=>!a.some((r,t)=>r==b[t]/*()(),,=mmer+*/)

[Try it online!][TIO-mdfoczb7]

[TIO-mdfoczb7]: https://tio.run/##jZBBboMwEEX3OYWzYoa4oHhVCQ2X6BKxGCcWoopxZJxcn5qIpDFq2q4sjd6f/8affOXx4PtzeLu@Twc3jEGcves8272gCViW@bYOeamlJUO1KUbnA@CuaaUnCxqRaguMRD6NK2KqNdVbjhFrALwMkfVEugltmQMCSknWGr/LS9xs0nJ/GQSJ2C80Cqofc2iKouBWzo9uMU2pFym1pBCWWHWv65w7xkNFk/Vs@cAhkyKLD9ues7ZaKM2voOMM3Sh3MsXJdZDNKyPwdAjE0lsRYpWycXFEtyt2rsPUUa3r7WW4HF2XOP4A2Tv0m6N6clR/OKpvR/VwfLBnHkczimCi0H71CR/B90MH9xFKkU7iunX18zq18v3fuukL "JavaScript (V8) – Try It Online"(improved with +[] and expecting arrayified strings, from Arnauld's solution)

Try it online!

JavaScript (V8) , 56 bytes

(a,/*!>t[]*/b,m=e=>[...e].sort().join``,r=m(b))=>m(a)==r
a=>b=>![...a].some((r,t)=>r==b[t]/*()()``,,=.jmmnieor*/)

Try it online!

It's a bit unclear to me whether single-line comments (// ...)should be accepted for arrow-functions because they don't seem to be generally parsed as part of the function. I've erred on the side of caution and not used them.

Source Link
Steve Bennett
  • 8.1k
  • 23
  • 74

JavaScript (V8), 56 bytes

(a,/*!>t[]*/b,m=e=>[...e].sort().join``,r=m(b))=>m(a)==r
a=>b=>![...a].some((r,t)=>r==b[t]/*()()``,,=.jmmnieor*/)

Try it online!

It's a bit unclear to me whether single-line comments (// ...)should be accepted for arrow-functions because they don't seem to be generally parsed as part of the function. I've erred on the side of caution and not used them.

AltStyle によって変換されたページ (->オリジナル) /