The question remains, does the for in kill the man what if it sorts lexically and not numerically? Should I have just for (const x of sparse) if (typeof x !== "undefined") out[o++] = x?
Maybe
function*isDef(it){for(constxofit)if(typeofx!=="undefined")yieldx}constsolve=arr=>{constvals=newMap()// tfw no Map::with_capacityfor(leti=0;i<arr.length;i++)vals.set(arr[i],i)constsparse=newArray(arr.length)for(const[v,i]ofvals)sparse[i]=vconstout=newArray(vals.length)constsearch=isDef(sparse)for(leti=0;i<vals.length;i++)out[i++]=search.next()returnout}
ayy lmao
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
javascript
The question remains, does the
for in
kill the man what if it sorts lexically and not numerically? Should I have justfor (const x of sparse) if (typeof x !== "undefined") out[o++] = x
?Maybe
ayy lmao