Skip to content

Commit 96e9fc2

Browse files
add 3151 prod variant
1 parent 62c3d92 commit 96e9fc2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

contest/src/main/java/com/github/contest/array/ArrayProdVariant.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@ fun getCommonProdVariant(nums1: IntArray, nums2: IntArray): Int {
1515
}
1616
.filterNotNull()
1717
.firstOrNull() ?: -1
18-
}
18+
}
19+
20+
/**
21+
* 3151. Special Array I
22+
* Prod Variant
23+
*/
24+
25+
fun isArraySpecialProdVariant(nums: IntArray): Boolean =
26+
nums.isEmpty() || nums.toList().windowed(2).all { (a, b) -> a % 2 != b % 2 }

0 commit comments

Comments
 (0)