Increasing Triplet Subsequence

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.
I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.
Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such indices exists, return false.
LeetCode Problem - 334: Link | Click Here
class Solution {
public boolean increasingTriplet(int[] nums) {
// Initialize two variables to store the first and second elements of the triplet
int firstElement = Integer.MAX_VALUE;
int midElement = Integer.MAX_VALUE;
// Iterate through the array
for (int num : nums) {
// Check if the current number is less than or equal to the first element
if (num <= firstElement) {
// Update the first element to the current number
firstElement = num;
}
// Check if the current number is less than or equal to the second element
else if (num <= midElement) {
// Update the second element to the current number
midElement = num;
}
// If neither condition is met, it means we have found an increasing triplet
else {
// Return true
return true;
}
}
// If no increasing triplet is found, return false
return false;
}
}




