For today’s algorithm, I picked the binary search which is one of the most commonly asked topics in technical interviews. The problem named binary search from LeetCode will be used to explain this concept:
Given a sorted (in ascending order) integer array nums
of n
elements and a target
value, write a function to search target in nums
. If target
exists, then return its index, otherwise return -1
.
#javascript #algorithms #arrays #programming #binary-search