Tap here to switch tabs
Problem
Submissions

Problem: Arithmetic Slices

Try to solve the Arithmetic Slices problem.

Statement

An integer sequence is called arithmetic if it contains at least 33 elements and the difference between any two consecutive elements is constant.

Given an integer array nums, return the number of arithmetic subarrays of nums.

A subarray is a contiguous subsequence of an array.

Constraints:

  • 1≤1 \leq nums.length ≤5000\leq 5000

  • −1000≤-1000 \leq nums[i] ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Arithmetic Slices

Try to solve the Arithmetic Slices problem.

Statement

An integer sequence is called arithmetic if it contains at least 33 elements and the difference between any two consecutive elements is constant.

Given an integer array nums, return the number of arithmetic subarrays of nums.

A subarray is a contiguous subsequence of an array.

Constraints:

  • 1≤1 \leq nums.length ≤5000\leq 5000

  • −1000≤-1000 \leq nums[i] ≤1000\leq 1000