Skip to content

Commit 6466e2b

Browse files
refactor 446
1 parent 7db7376 commit 6466e2b

File tree

1 file changed

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

1 file changed

+0
-40
lines changed

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

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,6 @@
33
import java.util.HashMap;
44
import java.util.Map;
55

6-
/**
7-
* 446. Arithmetic Slices II - Subsequence
8-
*
9-
* A sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.
10-
11-
For example, these are arithmetic sequences:
12-
13-
1, 3, 5, 7, 9
14-
7, 7, 7, 7
15-
3, -1, -5, -9
16-
17-
The following sequence is not arithmetic.
18-
19-
1, 1, 2, 5, 7
20-
21-
A zero-indexed array A consisting of N numbers is given. A subsequence slice of that array is any sequence of integers (P0, P1, ..., Pk) such that 0 ≤ P0 < P1 < ... < Pk < N.
22-
23-
A subsequence slice (P0, P1, ..., Pk) of array A is called arithmetic if the sequence A[P0], A[P1], ..., A[Pk-1], A[Pk] is arithmetic. In particular, this means that k ≥ 2.
24-
25-
The function should return the number of arithmetic subsequence slices in the array A.
26-
27-
The input contains N integers. Every integer is in the range of -231 and 231-1 and 0 ≤ N ≤ 1000. The output is guaranteed to be less than 231-1.
28-
29-
30-
Example:
31-
32-
Input: [2, 4, 6, 8, 10]
33-
34-
Output: 7
35-
36-
Explanation:
37-
All arithmetic subsequence slices are:
38-
[2,4,6]
39-
[4,6,8]
40-
[6,8,10]
41-
[2,4,6,8]
42-
[4,6,8,10]
43-
[2,4,6,8,10]
44-
[2,6,10]
45-
*/
466
public class _446 {
477
public static class Solution1 {
488
/**

0 commit comments

Comments
 (0)