GeeksforGeeks » Algorithms

Maximizing valleys in an unsorted array:

(1 post)
  • Started 3 months ago by geek
  1. geek
    guest
    Posted 3 months ago #

    A Valley is cell (in an array) which has less value than its immediate neighbours. Given an unsorted array, the task is to rearrange the numbers in such a manner so as to maximize the number of valleys in that array.

    Now redefine the Valley to extend the problem. A Valley is now a cell which has value less by a given threshold than its immediate neighbours.

    The first part seems easy. Please suggest solutions for the extended problem.


Reply

You must log in to post.

RSS feed for this topic