given an array, for each element, find out the total number of elements lesser than it, which appear to the right of it

后端 未结 10 1802
傲寒
傲寒 2021-02-04 11:43

I had previously posted a question, Given an array, find out the next smaller element for each element now, i was trying to know , if there is any way to find out \"given an ar

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 11:57

    //some array called newarray
    for(int x=0; x <=array.length;x++)
    {
    for(int y=x;y

    something like this,where array is your input array and newarray your output array make sure to initialize everything correctly(0 for the newarrays values)

提交回复
热议问题