15,851,242 members
See more:
`You are given an array of  'A' of length 'N' . In one operation , you can create an array 'R' of length 'N' such that the sum of the elements of 'R' is at most 'X' , then set 'A[i]' to 'A[I]-R[i]' for all 'i'. you are also given Q' queries of the form 'K, Y',changing 'A[K]' TO 'Y'. Return an array 'B' of length 'Q' such that 'B[i]' represents the minimum number of operations to make all elements of 'A' equal to '0' after the i-th query.`

What I have tried:

`def countOperations(n: int, a: List[int], x: int, q: int, queries: List[List[int]]) -> List[int]:`
Posted
Updated 17-Jun-23 5:18am
Richard MacCutchan 17-Jun-23 10:03am
I think this is a question you are expected to solve for yourself.
Dave Kreskowiak 17-Jun-23 10:54am
No, we're not here to do your homework for you.

You're looking at this from the point of "I need to pass this class", not from the point of "what do I have to learn to complete this assignment, so I can pass this class."

## Solution 1

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

Just posting your assignment and asking for code isn't going to get you anywhere.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]