import java.util.Arrays; public class SpeedLimit { public static int sequence(int[] arr) { return Arrays.stream(arr).sum(); } }
- import java.util.Arrays;
- public class SpeedLimit {
public static int sequence(int[] arr) {int result = 0; // initialize the result to 0for (int i = 0; i < arr.length; i++) {// add the current element to the resultresult += arr[i];}return result; // return the result}- public static int sequence(int[] arr) {
- return Arrays.stream(arr).sum();
- }
- }