From ac55c317cc06c2c113125949399c000a7e003b8d Mon Sep 17 00:00:00 2001 From: Tushar Tanaji Kurade Date: Thu, 30 Oct 2025 00:00:14 +0530 Subject: [PATCH] Implement increasing triplet subsequence check --- increasingTriplet_shadowkakashi.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 increasingTriplet_shadowkakashi.cpp diff --git a/increasingTriplet_shadowkakashi.cpp b/increasingTriplet_shadowkakashi.cpp new file mode 100644 index 0000000..a071773 --- /dev/null +++ b/increasingTriplet_shadowkakashi.cpp @@ -0,0 +1,12 @@ +class Solution { +public: + bool increasingTriplet(vector& nums) { + int first = INT_MAX, second = INT_MAX; + for (int n : nums) { + if (n <= first) first = n; + else if (n <= second) second = n; + else return true; + } + return false; + } +};