Counting Zeros in a Sorted Array
Problem statement
Given a sorted array that may contain zeros, count how many zeros it holds. You are expected to beat a linear scan.
Example
count_zeros([-1, 1]) -> 0Show hint
What property of a sorted array lets you locate a boundary without looking at every element?
Relevant roles: ML Engineer, Forward Deployed Engineer and AI Engineer.