From 21b725fc111382e044cc717275d3e359e4c76858 Mon Sep 17 00:00:00 2001 From: Swaroop Phatak Date: Wed, 29 Oct 2025 23:38:41 +0530 Subject: [PATCH] Implement increasingTriplet function in Solution class --- increasingTriplet_swaroop-phatak.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 increasingTriplet_swaroop-phatak.cpp diff --git a/increasingTriplet_swaroop-phatak.cpp b/increasingTriplet_swaroop-phatak.cpp new file mode 100644 index 0000000..a071773 --- /dev/null +++ b/increasingTriplet_swaroop-phatak.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; + } +};