Greedy Algorithms8 sections · 316 units
Open in CourseQuiz: Wiggle Subsequence
Why this greedy works
Check Your Understanding
Why does counting peaks and valleys give the longest wiggle subsequence?
- A.Peaks and valleys are easy to count
- B.Peaks and valleys represent direction changes, which maximize wiggle length
- C.Every wiggle subsequence must include all peaks and valleys
- D.It is a coincidence that works for this problem