66. Plus One
2016-03-14 13:06
337 查看
class Solution { public: vector<int> plusOne(vector<int>& digits) { int plus=1; for(auto a=digits.end()-1;a!=digits.begin();a--) { if(*a+plus==10) { *a=0; plus=1; } else { *a+=plus; return digits; } } auto a=digits.begin(); if(*a+plus==10) { *a=0; digits.insert(a,1); } else *a+=plus; return digits; } };
相关文章推荐
- Spring中LocalSessionFactoryBean与SessionFactory
- ajax请求Url加参数的使用方法
- ViurtualBox配置虚拟机Linux的网络环境
- Visual Stuido 2015 Community 使用 GitHub 插件
- 不小心打开了show children怎么关闭的问题
- Eclipse护眼背景色
- 58. Length of Last Word
- 38. Count and Say
- 27. Remove Element
- 26. Remove Duplicates from Sorted Array
- Linux下简单线程池的实现
- Web系统大规模并发:电商秒杀与抢购
- ModelMap和ModelAndView
- Dom4j工具类
- 《我是一只IT小小鸟》读后感
- 21. Merge Two Sorted Lists
- 19. Remove Nth Node From End of List
- Leetcode 13. Roman to Integer
- java jps命令
- json 筛选数据 $.grep过滤数据