Skip to content

Instantly share code, notes, and snippets.

@osahondev
Last active April 19, 2021 19:02
Show Gist options
  • Select an option

  • Save osahondev/8d14387f1d2c031b364c823cc6db2c4b to your computer and use it in GitHub Desktop.

Select an option

Save osahondev/8d14387f1d2c031b364c823cc6db2c4b to your computer and use it in GitHub Desktop.
Function to remove instances from a value and return new length
const elementRemoval = (nums,val) =>{
if( nums == undefined )
return 0
return nums.filter( num=>num!=val ).length;
}
@osahondev
Copy link
Author

Thanks for the feedback. On a second look at other implementations, perhaps there truly is a better way. I would study them to improve on my efficiency. Keep up the good work by the way. Really love Algo Friday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment