1. You are given an array(arr) of integers. 2. You have to find the count of arithmetic slices in the given array. 3. Arithmetic slice is defined as the sub-array having all its elements in A.P and the length of sub-array should be greater than or equal to 3.
Input Format
A number N arr1 arr2.. N numbers
Output Format
Check the sample output and question video.
Constraints
1 <= N <= 10^8 -10^8 <= arr[i] <= 10^8
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
4 1 2 3 4
Output
3