leetle

Daily challenge for 2026-07-22

568. Find Last Active Timestamp

You are given a sorted array of integers representing timestamps of user activities, and a target timestamp. Because multiple activities can occur at the exact same timestamp, the target may appear multiple times.

Write a function to find the index of the last occurrence of the target timestamp using binary search. If the target is not present in the array, return -1.

Your solution must run in O(log n) time.

Example:
Input: timestamps = [10, 20, 20, 20, 30], target = 20
Output: 4

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