Hi All,
Following question was asked to me -
Given an array, find if the sequence is increasing then decreasing or decreasing then increasing. Return false if not.
1 2 5 4 1 [values increasing then decreasing]
2 2 2 4 5
4 2 1 5 7 8 [values decreasing then increasing]
9 9 5 4 2 2
Edge cases -
1
2 2 2
5 6 7
Facebook is known to ask questions from leetcode fb tags but I'm having trouble finding this problem on leetcode.
Any leads would be appreciated.
Thanks All!