We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4ae896 commit 7441d3aCopy full SHA for 7441d3a
src/main/kotlin/g0801_0900/s0805_split_array_with_same_average/Solution.kt
@@ -3,18 +3,17 @@ package g0801_0900.s0805_split_array_with_same_average
3
// #Hard #Array #Dynamic_Programming #Math #Bit_Manipulation #Bitmask
4
// #2023_03_16_Time_142_ms_(100.00%)_Space_33.7_MB_(100.00%)
5
6
-import java.util.Arrays
7
-
8
@Suppress("NAME_SHADOWING")
9
class Solution {
10
private lateinit var nums: IntArray
11
private lateinit var sums: IntArray
+
12
fun splitArraySameAverage(nums: IntArray): Boolean {
13
val len = nums.size
14
if (len == 1) {
15
return false
16
}
17
- Arrays.sort(nums)
+ nums.sort()
18
sums = IntArray(len + 1)
19
for (i in 0 until len) {
20
sums[i + 1] = sums[i] + nums[i]
0 commit comments