码迷,mamicode.com
首页 > 其他好文 > 详细

leetcode334

时间:2018-10-04 15:23:21      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:[]   nbsp   bool   incr   for   lse   tco   als   int   

public class Solution
    {
        public bool IncreasingTriplet(int[] nums)
        {
            var len = nums.Length;
            if (len < 3)
            {
                return false;
            }

            for (int i = 0; i <= len - 3; i++)
            {
                for (int j = i + 1; j <= len - 2; j++)
                {
                    if (nums[i] < nums[j])
                    {
                        for (int k = j + 1; k <= len - 1; k++)
                        {
                            if (nums[j] < nums[k])
                            {
                                return true;
                            }
                        }
                    }

                }
            }

            return false;
        }
    }

 

leetcode334

标签:[]   nbsp   bool   incr   for   lse   tco   als   int   

原文地址:https://www.cnblogs.com/asenyang/p/9742241.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!