Skip to content

Commit 9358a2b

Browse files
refactor 413
1 parent 786564c commit 9358a2b

File tree

1 file changed

+0
-28
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-28
lines changed

src/main/java/com/fishercoder/solutions/_413.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 413. Arithmetic Slices
5-
*
6-
* A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.
7-
8-
For example, these are arithmetic sequence:
9-
10-
1, 3, 5, 7, 9
11-
7, 7, 7, 7
12-
3, -1, -5, -9
13-
14-
The following sequence is not arithmetic.
15-
16-
1, 1, 2, 5, 7
17-
18-
A zero-indexed array A consisting of N numbers is given. A slice of that array is any pair of integers (P, Q) such that 0 <= P < Q < N.
19-
20-
A slice (P, Q) of array A is called arithmetic if the sequence:
21-
A[P], A[p + 1], ..., A[Q - 1], A[Q] is arithmetic. In particular, this means that P + 1 < Q.
22-
23-
The function should return the number of arithmetic slices in the array A.
24-
25-
Example:
26-
27-
A = [1, 2, 3, 4]
28-
29-
return: 3, for 3 arithmetic slices in A: [1, 2, 3], [2, 3, 4] and [1, 2, 3, 4] itself.
30-
*/
313
public class _413 {
324

335
public static class Solution1 {

0 commit comments

Comments
 (0)