注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
求加米谢谢!
-----------
Q1
Starting with an empty set of integers named elements, perform the following query operations:
The command push x inserts the value of x into elements.
The command pop x removes the value of x from elements.
The integers in elements need to be ordered in such a way that after each operation is performed, the product of the maximum and minimum values in the set can be easily calculated.
Function Description:
Complete the function maxMin in the editor below.
maxMin has the following parameter(s):
1. string operations[n]: an array of operations strings
2. int x[nwing parameter(s):
int x: the starting value
int y: the target value
int z: the maximum number of steps
Returns:
int the maximum integer which can be made from x while converting x to y in at most z steps; if x cannot be converted to y after at most z steps, return -1
Constraints:
1 <= x, y, z <= 10^8 |