Tap here to switch tabs
Problem
Submissions

Problem: Find the Maximum Number of Marked Indices

med
30 min
Try to solve the Find the Maximum Number of Marked Indices problem.

Statement

You are given a 00 indexed integer array nums.

Initially, all indices are unmarked. You can perform the following operation any number of times:

  • Pick two distinct unmarked indices i and j such that 2imes2 imes nums[i] ≤\leq nums[j].

  • Mark both index i and index j.

Return the maximum possible number of marked indices after performing the operation optimally.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Maximum Number of Marked Indices

med
30 min
Try to solve the Find the Maximum Number of Marked Indices problem.

Statement

You are given a 00 indexed integer array nums.

Initially, all indices are unmarked. You can perform the following operation any number of times:

  • Pick two distinct unmarked indices i and j such that 2imes2 imes nums[i] ≤\leq nums[j].

  • Mark both index i and index j.

Return the maximum possible number of marked indices after performing the operation optimally.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

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