Topic: Dynamic Programming Problem / Level: beginner

Problem: Find the longest alternating subsequence in an array where the elements alternate between increasing and decreasing using dynamic programming.

Run the code to see the output here...