Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
7 events
when toggle format what by license comment
Mar 3 at 21:00 comment added Nathan Ruffing Элёржон Кимсанов, the result is kind of a sum of each element's value relative to its neighbors. With ascending or descending, 0 means higher + lower = 0. If both neighbors are lower, lower + lower = -2 so there's a maximum. If one neighbor is lower and the other equal, lower + equal = -1, so max of one side, but not a full local maximum. If there is another -1 before a 1, then the sequence drops again and you have a group that is the local maximum from the first -1 to the second -1. I like this answer the best.
Aug 26, 2022 at 14:27 comment added Элёржон Кимсанов It ignores cases with repetitive elements. Eg [1,2,3,1,2,2,2,1,4,5]. How to fix it?
Mar 29, 2021 at 10:46 history edited desertnaut CC BY-SA 4.0
deleted 35 characters in body
Aug 26, 2018 at 19:00 review Suggested edits
Aug 26, 2018 at 19:45
Aug 16, 2018 at 10:04 comment added Brandon Rhodes I think that this (good!) answer is the same as R. C.'s answer from 2012? He offers three one-line solutions, depending on whether the caller wants mins, maxes, or both, if I'm reading his solution correctly.
Apr 24, 2018 at 11:06 review Late answers
Apr 24, 2018 at 11:07
Apr 24, 2018 at 10:48 history answered Dave CC BY-SA 3.0