Let's now get into the code for solving the power sum function.
Okay.
So over here we are given an array and we have to find the power sum.
So let's say let sum is equal to zero.
And finally we will be just returning math dot pow sum to the power.
Power okay.
Where power is what we have over here okay.
And initially it's equal to one.
Now what we're going to do is we are going to go through each element in the input array.
And we know that each element in the input array is either an array itself or an integer.
Okay.
So we can say array dot for each.
So we're going to go through each item of the input array.
And for each item we are going to check whether it's an array.
So if array dot is array item okay.
So if it is an array then we'll be doing something.
And if it's not an array then we will be doing something else.
So that's the structure right now if the element at hand or the item at hand is not an array, then
it's pretty straightforward.
We will just have to add that value to the sum okay.
But if it is an array, then we would have to recursively call the same power sum function.
And at this point the array which we pass to this function would be the item that we are considering,
because again we know that this is an array.
So that's why we have reached over here.
And the power which we pass to this function would be one more than what the value of power at this
point is.
Okay.
And that's it.
So this should solve the question.
Now let's go ahead and run this code and see if it's passing all the test cases.
And you can see that it's passing all the test cases.
Now, in case you want some help to debug your code.
Do make use of the user logs you are provided over here, which is available for each test case.