Tap here to switch tabs
Problem
Submissions

Problem: Find the Minimum Possible Sum of a Beautiful Array

med
30 min
Try to solve the Find the Minimum Possible Sum of a Beautiful Array problem.

Statement

You are given two positive integers, n and target.

An array nums is considered beautiful if it satisfies the following conditions:

  • nums.length is equal to n.

  • nums consists of pairwise distinct positive integers.

  • There do not exist two distinct indices i and j such that nums[i] + nums[j] is equal to target.

Return the minimum possible sum of elements in a beautiful array.

Constraints:

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

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Minimum Possible Sum of a Beautiful Array

med
30 min
Try to solve the Find the Minimum Possible Sum of a Beautiful Array problem.

Statement

You are given two positive integers, n and target.

An array nums is considered beautiful if it satisfies the following conditions:

  • nums.length is equal to n.

  • nums consists of pairwise distinct positive integers.

  • There do not exist two distinct indices i and j such that nums[i] + nums[j] is equal to target.

Return the minimum possible sum of elements in a beautiful array.

Constraints:

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

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