Skip to content

Instantly share code, notes, and snippets.

View median-man's full-sized avatar

John Desrosiers median-man

  • El Cajon, CA USA
View GitHub Profile
@median-man
median-man / .gitmessage
Last active July 3, 2024 04:38 — forked from adeekshith/.git-commit-template.txt
This commit message template helps you write **useful** commit messages.
# <type>: <subject> (Max 50 char, Why is this change necessary?)
# |<---- Using a Maximum Of 50 Characters ---->|
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Explain how the commit addresses the issue
# IMPORTANT!! Describe any side effects of the change.
# Provide links or keys to any relevant tickets, articles or other resources
# Examples: "Jira issue [ABC-123]" or "Closes Github issue #123"
//see if sequence of nums is in increasing order, but seq is allowed to decrease once.
// The Goldilocks solution
function checkSequence(arr) {
const maxOutOfSequencePermitted = 1
let countOfOutOfSequence = 0
for (let i = 1; i < arr.length; i += 1) {
if (arr[i] < arr[i - 1]) {
countOfOutOfSequence += 1
}