+ 1

My code is taking too much time to execute how can i optimise .

Reverse an array https://code.sololearn.com/cpxum5CjOb50/?ref=app

20th Aug 2020, 4:38 AM
Tina_Agrawal
Tina_Agrawal - avatar
2 Respostas
+ 1
Thankyou so much
20th Aug 2020, 7:35 AM
Tina_Agrawal
Tina_Agrawal - avatar
0
Try this for the swapping loop instead of a `while` loop ... for (i = 0, j = n - 1; i < n / 2; i++, j--) { temp = a[i]; a[i] = a[j]; a[j] = temp; }
20th Aug 2020, 4:58 AM
Ipang