Skip to content

Commit e012d19

Browse files
Update README_EN.md
I gave second way of solution of java
1 parent 882870c commit e012d19

File tree

1 file changed

+12
-0
lines changed
  • solution/0200-0299/0238.Product of Array Except Self

1 file changed

+12
-0
lines changed

solution/0200-0299/0238.Product of Array Except Self/README_EN.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,15 @@ function productExceptSelf(nums: number[]): number[] {
267267
<!-- solution:end -->
268268

269269
<!-- problem:end -->
270+
271+
#### Java
272+
273+
```java
274+
class Solution {
275+
public int[] productExceptSelf(int[] nums) {
276+
return IntStream.range(0, nums.length)
277+
.map(i -> IntStream.range(0, nums.length)
278+
.reduce(1, (p, j) -> j == i ? p : p * nums[j]))
279+
.toArray();
280+
}
281+
}

0 commit comments

Comments
 (0)