Tap here to switch tabs
Problem
Submissions

Problem: Check If a Number Is Majority Element in a Sorted Array

Try to solve the Check If a Number Is Majority Element in a Sorted Array problem.

Statement

Given an integer array nums sorted in non decreasing order and an integer target, return true if target is a majority element of nums, or false otherwise.

A majority element is an element that appears strictly more than nums.length /2/ 2 times in the array.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i], target ≤109\leq 10^9

  • nums is sorted in non decreasing order.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check If a Number Is Majority Element in a Sorted Array

Try to solve the Check If a Number Is Majority Element in a Sorted Array problem.

Statement

Given an integer array nums sorted in non decreasing order and an integer target, return true if target is a majority element of nums, or false otherwise.

A majority element is an element that appears strictly more than nums.length /2/ 2 times in the array.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i], target ≤109\leq 10^9

  • nums is sorted in non decreasing order.