How can i find peak element with using def in python

  arraylist, arrays, list, python, python-3.x

For a given list, if for element a, there is no neighbour element greater than a, then is called peak element. Complete the following function which returns the list of peak elements of given list L:

for L = [3,2,4,5,4,3,2,2], the function call tepeNoktalari(L) should return the list [3,5,2].

Source: Python Questions

LEAVE A COMMENT