首页 > 编程语言 > 详细

算法中的反转问题

时间:2018-08-20 12:53:00      阅读:183      评论:0      收藏:0      [点我收藏+]
1 void reverse(vector<int>& word){
2         size_t first, last;
3         first = 0;
4         last = word.size();
5         while ((first != last) && (first != --last))
6             std::swap(word[first++], word[last]);
7     }

反转这类题目多和其他类型的题目相结合,难度不大,其中最重要的是要掌握对字符串,数组的反转操作。

算法中的反转问题

原文:https://www.cnblogs.com/zousantuier/p/9504068.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!