Skip to content

Number of Triples #2405

@erickcernarequejo

Description

@erickcernarequejo

Write a program that reads an array of ints and outputs the number of "triples" in the array.

A "triple" is three consecutive ints in increasing order differing by 1 (i.e. 3,4,5 is a triple, but 5,4,3 and 2,4,6 are not).

Sample Input:
6
1 2 4 5 6 7

Sample Output:
2

Sample Input:
6
1 4 7 5 4 3

Sample Output:
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions