Skip to main content
added alternate versions
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (ES6), 43 bytes

a=>a.filter(s=>a[q=[...s].sort()]?0:a[q]=1) 

Try it online!

Alternate versions (same size)

a=>a.filter(([...s])=>a[s.sort()]?0:a[s]=1) 

Try it online!

a=>a.filter(([...s])=>a[s.sort()]^(a[s]=1)) 

Try it online!

Commented

a => // a[] = input array a.filter(s => // for each string s in a[]: a[ // test a[q]: q = // where q[] is the array [...s] // made of the characters of s .sort() // sorted in lexicographical order ] ? // if a[q] is already defined: 0 // discard this entry : // else: a[q] = 1 // set a[q] and keep this entry ) // end of filter() 

JavaScript (ES6), 43 bytes

a=>a.filter(s=>a[q=[...s].sort()]?0:a[q]=1) 

Try it online!

Commented

a => // a[] = input array a.filter(s => // for each string s in a[]: a[ // test a[q]: q = // where q[] is the array [...s] // made of the characters of s .sort() // sorted in lexicographical order ] ? // if a[q] is already defined: 0 // discard this entry : // else: a[q] = 1 // set a[q] and keep this entry ) // end of filter() 

JavaScript (ES6), 43 bytes

a=>a.filter(s=>a[q=[...s].sort()]?0:a[q]=1) 

Try it online!

Alternate versions (same size)

a=>a.filter(([...s])=>a[s.sort()]?0:a[s]=1) 

Try it online!

a=>a.filter(([...s])=>a[s.sort()]^(a[s]=1)) 

Try it online!

Commented

a => // a[] = input array a.filter(s => // for each string s in a[]: a[ // test a[q]: q = // where q[] is the array [...s] // made of the characters of s .sort() // sorted in lexicographical order ] ? // if a[q] is already defined: 0 // discard this entry : // else: a[q] = 1 // set a[q] and keep this entry ) // end of filter() 
added a commented version
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (ES6), 43 bytes

a=>a.filter(s=>a[q=[...s].sort()]?0:a[q]=1) 

Try it online!

Commented

a => // a[] = input array a.filter(s => // for each string s in a[]: a[ // test a[q]: q = // where q[] is the array [...s] // made of the characters of s .sort() // sorted in lexicographical order ] ? // if a[q] is already defined: 0 // discard this entry : // else: a[q] = 1 // set a[q] and keep this entry ) // end of filter() 

JavaScript (ES6), 43 bytes

a=>a.filter(s=>a[q=[...s].sort()]?0:a[q]=1) 

Try it online!

JavaScript (ES6), 43 bytes

a=>a.filter(s=>a[q=[...s].sort()]?0:a[q]=1) 

Try it online!

Commented

a => // a[] = input array a.filter(s => // for each string s in a[]: a[ // test a[q]: q = // where q[] is the array [...s] // made of the characters of s .sort() // sorted in lexicographical order ] ? // if a[q] is already defined: 0 // discard this entry : // else: a[q] = 1 // set a[q] and keep this entry ) // end of filter() 
saved 2 bytes
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (ES6), 4543 bytes

a=>a.filter(s=>a[q=[...s].sort()+0]]?0:a[q]=1) 

Try it online!Try it online!

JavaScript (ES6), 45 bytes

a=>a.filter(s=>a[q=[...s].sort()+0]?0:a[q]=1) 

Try it online!

JavaScript (ES6), 43 bytes

a=>a.filter(s=>a[q=[...s].sort()]?0:a[q]=1) 

Try it online!

Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670
Loading