LeetCode problem #34 — Find First and Last Position of Element in Sorted Array (JavaScript)

Solution #1: Binary search

Solution #2: For loop

Solution #3: indexOf()

--

--

--

Full-stack software developer from the UK, author of the Aftermath book series, full time tech-nerd.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Angular Form Errors Component

How I solved the pyramid algorithm in JavaScript

Host a Microservice in Heroku that mass deletes picklist options in salesforce, for free

Wipe out all the picklist options in a picklist field in salesforce

Grunt uglify ES6 support

DENO: Create your first server

Real-Time Updating Map Website Tutorial

A journey through ReactDOM.render — An explanation of how React manages the DOM and state

Reducing Your Reaction: Understanding React-Redux

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Duncan McArdle

Duncan McArdle

Full-stack software developer from the UK, author of the Aftermath book series, full time tech-nerd.

More from Medium

LeetCode 128. Longest Consecutive Sequence — JavaScript

What is a Linked List? How to Implement Singly Linked List in JavaScript

A visual represenataion of a linked list

How to Detect a Cycle in a Linked List

Array Fundamentals in JavaScript