Tap here to switch tabs
Problem
Submissions

Problem: Sliding Subarray Beauty

med
30 min
Try to solve the Sliding Subarray Beauty problem.

Statement

Given an integer array nums of size n, and two integers k and x, calculate the beauty of each subarray of size k.

The beauty of a subarray is defined as the xextthx^{ ext{th}} smallest negative integer in that subarray. If the subarray contains fewer than x negative integers, its beauty is 00.

Return an integer array containing the beauty of each subarray of size k, ordered from the first subarray to the last.

Constraints:

  • n ==== nums.length

  • 1≤1 \leq n ≤105\leq 10^5

  • 1≤1 \leq k ≤\leq n

  • 1≤1 \leq x ≤\leq k

  • −50≤-50 \leq nums[i] ≤50\leq 50

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sliding Subarray Beauty

med
30 min
Try to solve the Sliding Subarray Beauty problem.

Statement

Given an integer array nums of size n, and two integers k and x, calculate the beauty of each subarray of size k.

The beauty of a subarray is defined as the xextthx^{ ext{th}} smallest negative integer in that subarray. If the subarray contains fewer than x negative integers, its beauty is 00.

Return an integer array containing the beauty of each subarray of size k, ordered from the first subarray to the last.

Constraints:

  • n ==== nums.length

  • 1≤1 \leq n ≤105\leq 10^5

  • 1≤1 \leq k ≤\leq n

  • 1≤1 \leq x ≤\leq k

  • −50≤-50 \leq nums[i] ≤50\leq 50