Leetcode problem

I tried to solve by vector but getting WA

Can you share your approach?

Also,By Using array
I have one doubt
If i don’t know the size of array then how to scan the elements of array when user enter elements?

Refer this and this

What to do next?

In this problem you need not to take any inputs. You just have to complete the function given. Wait till I do it myself if you don’t understand.

:thinking:

Refer this link to understand

It is fairly easy, just understand that it is a “progression”.