why the result of [1,2,3,4,5,6] is 10 not 12?


  • 1
    F

    I am confused with this problem, suppose we have [1,2,3,4,5,6] as inputs, then we can get these slice:

    [1,2,3]
    [2,3,4]
    [3,4,5]
    [4,5,6]
    [1,2,3,4]
    [2,3,4,5]
    [3,4,5,6]
    [1,2,3,4,5]
    [2,3,4,5,6]
    [1,2,3,4,5,6]
    [1,3,5]
    [2,4,6]

    it has 12 slices, is there any problem ?

    Thanks a lot


  • 0

    The last two aren't slices.


  • 1

    @Frank1993I am confused it for a long time ....
    So I read the definition again...and NMB...

    if the difference between any two consecutive elements is the same.


  • 0
    Y

    remember it's a "slice" of original array. So must be continuous


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.