nuxy / leetcode-334

Benchmark created on


Description

Increasing Triplet Subsequence

Setup

const increasingTriplet = function(nums) {
  let currNum = 0;
  let nextNum = 0;
  let lastNum = 0;

  let bool = false;

  for (let i = 0; i < nums.length; i++) {
    currNum = nums[i];
    nextNum = nums[i + 1];
    lastNum = nums[i + 2];
      
    if (currNum < nextNum && nextNum < lastNum) {  
      bool = true;
    }
  }

  return bool;
};

Test runner

Ready to run.

Testing in
TestOps/sec
Test 1
increasingTriplet([1,2,3,4,5]); // true
ready
Test 2
increasingTriplet([5,4,3,2,1]); // false
ready
Test 3
increasingTriplet([2,1,5,0,4,6]); // true
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.