Nowy kurs! Każdy programista powinien nauczyć się Generative AI!
Wypróbuj darmową lekcję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); }
2 odpowiedzi
0
~ swim ~ oops sorry . It's typing mistake. Please can you please check once
0
Sorry for less info.. What will you do if question itself given like that asked you to optimize it.