Class Solution
java.lang.Object
g2101_2200.s2177_find_three_consecutive_integers_that_sum_to_a_given_number.Solution
2177 - Find Three Consecutive Integers That Sum to a Given Number\.
Medium
Given an integer `num`, return _three consecutive integers (as a sorted array)_ _that **sum** to_ `num`. If `num` cannot be expressed as the sum of three consecutive integers, return _an **empty** array._
**Example 1:**
**Input:** num = 33
**Output:** [10,11,12]
**Explanation:** 33 can be expressed as 10 + 11 + 12 = 33.
10, 11, 12 are 3 consecutive integers, so we return [10, 11, 12].
**Example 2:**
**Input:** num = 4
**Output:** []
**Explanation:** There is no way to express 4 as the sum of 3 consecutive integers.
**Constraints:**
*
0 <= num <= 1015-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
sumOfThree
public long[] sumOfThree(long num)
-