拓冰建站拓冰建站
首页 / 资讯中心 / 正文

stl:reverse

时间复杂度on空间复杂度o1vectorinta/string a; reverse(a.begin(),a.end());vectorvectorinta上下翻转翻转行cppvectorvectorint a {{1, 2, 3},{4, 5, 6},{7, 8, 9}};reverse(a.begin(), a.end());// 结果:// {7, 8, 9}// {4, 5, 6}// {1, 2, 3}左右翻转翻转每行的列cppfor (auto row : a) {reverse(row.begin(), row.end());}// 结果:// {3, 2, 1}// {6, 5, 4}// {9, 8, 7}
分享:

看完干货,该让你的企业上线了

免费需求沟通 · 48 小时内出具建站方案 · 河南本地可上门