Increasing Triplet Subsequence
2016-05-01 11:45
381 查看
class Solution { public: bool increasingTriplet(vector<int>& nums) { if(nums.size()<3) return false; int t1=nums[0],t2=INT_MAX; for(int i=1;i<nums.size();i++) { if(nums[i]>t2) return true; else if(nums[i]>t1) { t2=nums[i]; } else t1=nums[i]; } return false; } };
相关文章推荐
- UIButton、UITextField、UISlider、UISwitch、UISegmentedControl
- HDU 1242 Rescue(图)
- 笔记3:FileWebRequest 与 FileWebResponse
- POJ 2031 Building a Space Station(最小生成树)
- HDU_4069_SquigglySudoku(DancingLinksX精确覆盖+BFS)
- Leetcode:63. Unique Paths II
- android UI(1)-PopupWindow
- Leetcode:62. Unique Paths
- 安卓handler
- How to solve Dell laptops fan issues in Ubuntu
- String、StringBuffer和StringBuider
- Druid数据库连接池的使用
- [Nordic][nRF51822][Build Break] identifier "GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS" is undefined
- 2016 UESTC Training for Data Structures 题解
- UIIMage与CGImage的关系
- Tab Bar Item
- LeetCode 334. Increasing Triplet Subsequence
- 对自定义UITableViewCell的理解
- nRF51822 自定义UUID,ble_advdata_set的时候 NRF_ERROR_DATA_SIZE 错误的解决
- 2016 UESTC Training for Data Structures R - Japan 树状数组求逆序数