← Accolite questions

Longest Zig-Zag Subsequence

Filed under Accolite · Also reported at Sigtuple

Given an array of integers, find the length of the longest subsequence such that the differences between successive elements alternate between positive and negative. The first difference (if one…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Accolite questions

Collected from public candidate posts and coding forums. Updated Nov 2026.