How can we minimize or decrease the speed of execution as well as memory occupied for the below code . Please help me in this. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How can we minimize or decrease the speed of execution as well as memory occupied for the below code . Please help me in this.

https://code.sololearn.com/cK9Y4coaKoa1/?ref=app

9th Sep 2018, 1:44 AM
Ronald
1 Answer
+ 1
pettemsrikanthvarma other than vector approach mentioned by Tind , you can go with dynamic array as below: int a[100000] can be changed to int* a = new int [n]
9th Sep 2018, 6:41 AM
Ketan Lalcheta
Ketan Lalcheta - avatar