1664. Number of schemes to generate balance numbers
Thought:
See when you read the question medium I know that it is definitely not really going to delete an element。Otherwise it will time out,So I tried to try polepythonFeature code:Use slice to process all data;
But it’s timeout。。
然后看官方answer,用的Dynamic planning。中心Thought是:
General nature,Now we will settle down i Delete elements,
Obviously the bidding i The previous element bidding will not change from this,Bidding i
The original was originally j,j>iThe array elements of the bid will move to the bidding j−1,
Immediately bidding i The subsequent bidding elements will become the rated element,
The even bidding element will become a strange number of bidding elements。
Code
1 | class Solution: |
1 | class Solution: |