Skip to main content
added 2 characters in body
Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

JavaScript (Firefox 30+30-57), 137 bytes

f=(a,b=["",...a],s=new Set(b.map(w=>w[0])))=>b.length>1?(s.size>1)+Math.max(...(for(c of s)f(a,[for(w of b)if(w&&w[0]==c)w.slice(1)]))):1 

There must be something wrong with my algorithm as I seem to have to special-case an empty string parameter.

JavaScript (Firefox 30+), 137 bytes

f=(a,b=["",...a],s=new Set(b.map(w=>w[0])))=>b.length>1?(s.size>1)+Math.max(...(for(c of s)f(a,[for(w of b)if(w&&w[0]==c)w.slice(1)]))):1 

There must be something wrong with my algorithm as I seem to have to special-case an empty string parameter.

JavaScript (Firefox 30-57), 137 bytes

f=(a,b=["",...a],s=new Set(b.map(w=>w[0])))=>b.length>1?(s.size>1)+Math.max(...(for(c of s)f(a,[for(w of b)if(w&&w[0]==c)w.slice(1)]))):1 

There must be something wrong with my algorithm as I seem to have to special-case an empty string parameter.

Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

JavaScript (Firefox 30+), 137 bytes

f=(a,b=["",...a],s=new Set(b.map(w=>w[0])))=>b.length>1?(s.size>1)+Math.max(...(for(c of s)f(a,[for(w of b)if(w&&w[0]==c)w.slice(1)]))):1 

There must be something wrong with my algorithm as I seem to have to special-case an empty string parameter.