博客
关于我
牛客题霸 [滑动窗口的最大值] 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-【1】配置
    查看>>
    Python-从子文件夹执行绝对导入
    查看>>
    Python-刷新页面,直到元素可单击
    查看>>
    PYTHON-唤醒+VOSK+DEEPSEEK+离线合成-实现纯离线大模型问答
    查看>>
    Python-在Dash回调中重用函数
    查看>>
    PYTHON-基本数据类型-元祖类型,字典类型,集合类型
    查看>>
    python-外观模式
    查看>>
    Python-如何使用FastAPI和uvicorn.run而不阻塞线程?
    查看>>
    Python-字典
    查看>>
    python-字符串
    查看>>
    Python-将二进制遮罩转换为多边形
    查看>>
    python-文件操作
    查看>>