Skip to content

hoangthuc701/Almost-Increasing-Sequence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Almost-Increasing-Sequence

Almost Increasing Sequence Solution in C++

bool almostIncreasingSequence(std::vector sequence) { int res=0; int max= -10000, secondmax= -10000; for (int i=0; i<sequence.size(); i++) { if (sequence[i]>max) { secondmax=max; max= sequence[i]; } else if (sequence[i]>secondmax) { max= sequence[i]; res++; } else res++; } return (res<2); }

About

Almost Increasing Sequence Solution in C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published