Zigzag Array | HackerRank

Determine the minimum number of elements to delete from a sequence so its elements alternate between increasing and decreasing.