电面,三哥,应该是被整了。
Suppose you have a multiplication table that is N by N. That is, a 2D array where the value at the i-th row and j-th column is (i + 1) * (j + 1) (if 0-indexed) or i * j (if 1-indexed).
Given integers N and X, write a function that returns the k-th smallest element in a N by N multiplication table. Also, take duplicate into account.
Eg. In below matrix of 5X5, 6th smallest number is 4. Its also 7th and 8th smallest number.
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
还有这题我现在也不知道怎么做。求大神助攻。。。
给2个array,一个是股票当前的价格Si,一个是未来的售价Pi(不用考虑时间因素)。给定你有的本金M。再给一个array限制每个股票最多可以买的数量。 求最大收益。
应该是个dp题。。。求解。。。