Tap here to switch tabs
Problem
Submissions

Problem: Largest Positive Integer That Exists With Its Negative

med
30 min
Try to solve the Largest Positive Integer That Exists With Its Negative problem.

Statement

Given an integer array nums that does not contain any zeros, find the largest positive integer k such that its negation also exists in the array.

Return the value of k. If no such integer exists, return −1-1.

Constraints:

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

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

  • nums[i] ≠0\neq 0

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Largest Positive Integer That Exists With Its Negative

med
30 min
Try to solve the Largest Positive Integer That Exists With Its Negative problem.

Statement

Given an integer array nums that does not contain any zeros, find the largest positive integer k such that its negation also exists in the array.

Return the value of k. If no such integer exists, return −1-1.

Constraints:

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

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

  • nums[i] ≠0\neq 0