Uber Oa
Anonymous User
2943
  1. given an array

Find number of elements equal to mean of neighbor elements.

2 4 6 6 3

Ans: 3
2,4,3 satisfy that condition
2=4+0/2, 4=2+6/2

  1. delete min of peak elements one by one in an array
    Peak element defined as it should be greater than it’s neighbors.

2,7,8,5,1,6,3,9,4
8,6,9 are peak elements. You should remove 6 first.
Ans: 6,8,7,5,9,2,4,3,1

  1. Spiral matrix but you should sort elements in border
    You should do for all elements

  2. given an array and operations
    There are 3 operations
    a) 2 then you should return min element in array
    b) (0,x) add x to elements of an array
    c? (1,x) add x to end of an array

Ans should be array with all values of operation 2 that is min at that time

Comments (12)