leetle

Daily challenge for 2025-02-01

32. Find First and Last Position of Element in Sorted Array

Write a function solve that finds the starting and ending position of a target value in a sorted array. If the target is not found, return [-1,-1]. Ideally, your solution should run in O(logn) time.

Example:
Input: [5,7,7,8,8,10], 8
Output: [3,4]

Run this challenge interactively in Python or JavaScript when the app loads.