1150. Check If a Number Is Majority Element in a Sorted Array
https://leetcode.com/problems/check-if-a-number-is-majority-element-in-a-sorted-array
Description
Given an integer array nums
sorted in non-decreasing order and an integer target
, return true
if target
is a majority element, or false
otherwise.
A majority element in an array nums
is an element that appears more than nums.length / 2
times in the array.
Example 1:
Example 2:
Constraints:
1 <= nums.length <= 1000
1 <= nums[i], target <= 109
nums
is sorted in non-decreasing order.
ac
Last updated