Tap here to switch tabs
Problem
Submissions

Problem: Cutting Ribbons

Try to solve the Cutting Ribbons problem.

Statement

You are given an integer array ribbons where each element represents the length of a ribbon, and an integer k. You are allowed to cut any ribbon into any number of positive integer length segments, or leave it uncut.

Return the maximum possible positive integer length of ribbon segments such that you can obtain at least k ribbons of that identical length. If it is impossible to obtain at least k ribbons of the same positive integer length, return 00.

Constraints:

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

  • 1≤1 \leq ribbons[i] ≤105\leq 10^5

  • 1≤1 \leq k ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Cutting Ribbons

Try to solve the Cutting Ribbons problem.

Statement

You are given an integer array ribbons where each element represents the length of a ribbon, and an integer k. You are allowed to cut any ribbon into any number of positive integer length segments, or leave it uncut.

Return the maximum possible positive integer length of ribbon segments such that you can obtain at least k ribbons of that identical length. If it is impossible to obtain at least k ribbons of the same positive integer length, return 00.

Constraints:

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

  • 1≤1 \leq ribbons[i] ≤105\leq 10^5

  • 1≤1 \leq k ≤109\leq 10^9