0

An array is given and below method contains logic for solve method. This logic takes more time to execute. So try to minimize

ans =0; int n=a.length; for(int i=n;i>=1;i--){ int temp=0; for(int j=1;i>=n;j++){ for(int k=n;k>=1;k--){ if(k>=i&&i>=j&&a[k-1]<a[i-1]) temp++; } } ans+=temp/(i); }

22nd Jul 2019, 3:40 AM
praveen kasojjala
praveen kasojjala - avatar
5 Réponses
0
~ swim ~ oops sorry . It's typing mistake. Please can you please check once
22nd Jul 2019, 8:27 AM
praveen kasojjala
praveen kasojjala - avatar
0
Sorry for less info.. What will you do if question itself given like that asked you to optimize it.
22nd Jul 2019, 10:08 AM
praveen kasojjala
praveen kasojjala - avatar