#261. has271
has271
Background
Description
Given an array of ints, return true if it contains a 2, 7, 1 pattern: a value, followed by the value plus 5, followed by the value minus 1. Additionally the 271 counts even if the "1" differs by 2 or less from the correct value.
Format
Input
Output
Samples
[1 2 7 1]
true
[1 2 8 1]
false
[2 7 1]
true
Limitation
1s, 1024KiB for each test case.