← 返回 snapchat 的题目列表Count Events Before Timestamp
类型:online_judge
snapchat
Given an array of events with each event identified by a timestamp, implement a function to find the count of events that occurred before a given query timestamp. The input includes a sorted array of timestamps and a single query timestamp. Output the count of events before the query timestamp.
Input:
Timestamps array: [1, 3, 5, 7, 9, 11, 13]
Query timestamp: 8
Output:
4
Assume the input size does not exceed 10^5.
Example
Input
1 3 5 7 9 11 13
8