博客
关于我
牛客题霸 [滑动窗口的最大值] C++题解/答案
阅读量:159 次
发布时间:2019-02-27

本文共 1011 字,大约阅读时间需要 3 分钟。

??????????????????????????????????????????????????????????????????????????

????

  • ????????????????????????????????????????
  • ????????????????????????????
  • ?????????????????????????????????????
  • ???????????????????????????????????????????????
  • ???????????????????????
  • ????

    #include 
    using namespace std;vector
    maxInWindows(const vector
    & num, unsigned int size) { vector
    result; int len = num.size(); if (len < size) { return result; } for (int i = 0; i <= len - size; ++i) { int max_val = -1; for (int j = i; j < i + size; ++j) { if (num[j] > max_val) { max_val = num[j]; } } result.push_back(max_val); } return result;}

    ????

  • ??????????????????????????????????????????
  • ????????????????????????????0????????????
  • ?????????????????????????????????????????
  • ???????????????????????
  • ??????????????????????
  • ?????????????????????????????????????O(n*k)???????????????????????

    转载地址:http://obzb.baihongyu.com/

    你可能感兴趣的文章
    Python中遍历字符串和字典
    查看>>
    Python中重复导入相同的库会发生问题吗?-ChatGPT4o作答
    查看>>
    python中非0即True,0即False
    查看>>
    python中高阶函数与装饰器(2)
    查看>>
    python之celery使用详解一
    查看>>
    python之glob
    查看>>
    python之Ipython的安装使用以及指定python版本号
    查看>>
    Python之json模块
    查看>>
    Python之lambda函数
    查看>>
    Python之matplotlib学习(一)
    查看>>
    python之Matplotlib详细分析(附代码)
    查看>>
    python之numpy详细分析(附代码)
    查看>>
    Python之OS模块进程管理介绍--os.fork()
    查看>>
    python之pandas详细分析(附代码)
    查看>>
    python之plt多图同框显示
    查看>>
    python之pyenv安装使用
    查看>>
    Python之random模块
    查看>>
    python之selenium访问网站被反爬限制封锁解决方法
    查看>>
    python之set函数
    查看>>
    python之virtualenv多环境管理
    查看>>