nums is sorted in non-decreasing order and may contain repeated values. Return how many times target appears.
Example 1
Input:
count_occurrences([1, 2, 2, 2, 3], 2)
Output:
3
Example 2
Input:
count_occurrences([1, 3], 2)
Output:
0
0 <= len(nums) <= 2 * 10**5nums is sorted in non-decreasing order.-10**9 <= nums[i], target <= 10**9in, .index, .count, min or sorted on the whole list, fails them.No results yet
Run your code to check it against the examples, or submit to run every test.