How to solve this problem on Medians?

Правка en1, от chari407, 2018-01-08 09:59:26

The problem is as follows: Given an array A1,A2....An, the array is called special if there is any Ai which satisfies either of the following cases: 1. Ai is the median of the subarray [A0,Ai-1], or 2. Ai is the median of the subarray [Ai+1,An-1].

If it is special, print 1, else print 0.

Example: Array is 3,6,8,4. This is special because 6 is the median of [8,4].

How to solve this problem?

Теги median

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский chari407 2018-02-04 08:12:09 0 (published)
en1 Английский chari407 2018-01-08 09:59:26 444 Initial revision (saved to drafts)