【问题标题】:Give a vector pair i have to find no. of pairs such that a number k is greater than first and smaller than second给一个向量对,我必须找到没有。对使得数字 k 大于 first 并且小于 second
【发布时间】:2018-10-10 03:42:52
【问题描述】:

i 的数量使得 v[i].first

【问题讨论】:

  • 请发MCVE
  • 绝对不可能在少于 O(n) 的时间内做到这一点,除非你知道一些你没有告诉我们的数组。

标签: algorithm sorting vector time-complexity binary-search


【解决方案1】:

足以被视为答案的提示:给定x数组元素小于或等于k,对于每个数组元素e,大于或等于k(不包括e ),有x这样的对。

【讨论】:

    猜你喜欢
    • 2020-01-01
    • 1970-01-01
    • 2017-10-29
    • 2017-08-17
    • 1970-01-01
    • 2013-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多