A mountain is an array with exactly one peak.
A valley is an array with exactly one trough.
Some examples of mountains and valleys:
Mountain A: [1, 3, 5, 4, 3, 2] // 5 is the peak
Mountain B: [-1, 0, -1] // 0 is the peak
Mountain B: [-1, -1, 0, -1, -1] // 0 is the peak (plateau on both sides is okay)
Valley A: [10, 9, 8, 7, 2, 3, 4, 5] // 2 is the trough
Valley B: [350, 100, 200, 400, 700] // 100 is the trough
Neither mountains nor valleys:
Landscape A: [1, 2, 3, 2, 4, 1] // 2 peaks (3, 4), not 1
Landscape B: [5, 4, 3, 2, 1] // Peak cannot be a boundary element
Landscape B: [0, -1, -1, 0, -1, -1] // 2 peaks (0)
Based on the rules above, write a function that takes in an array and returns either "mountain", "valley", or "neither".
landscapeType([3, 4, 5, 4, 3]) ➞ "mountain"
landscapeType([9, 7, 3, 1, 2, 4]) ➞ "valley"
landscapeType([9, 8, 9]) ➞ "valley"
landscapeType([9, 8, 9, 8]) ➞ "neither"