Longest Increasing Subsequence Problem Statement
Given 'N' students standing in a row with specific heights, your task is to find the length of the longest strictly increasing subsequence of their heights, ensuring the relative order remains unchanged.
Explanation:
A subsequence is a sequence derived from another sequence by deleting zero or more elements without changing the order of the remaining elements.
Input:
The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of each test case contains an integer ‘N’ , the number of students in the row.
The second line of each test case contains ‘N’ space separated integers representing the height of every student in the row.
Output:
For each test case, return the length of longest strictly increasing subsequence of heights.
Example:
Input:
T = 1
N = 5
heights = [10, 20, 10, 30, 40]
Output:
3
Explanation:
The longest increasing subsequence is [10, 30, 40] with length 3.
Constraints:
1 <= T <= 10
1 <= N <= 200
1 <= heights[i] <= 10^9
- Time Limit: 1 sec

AnswerBot
4mo
Find the length of the longest strictly increasing subsequence of heights of students in a row.
Iterate through the heights array and for each element, find the length of the longest increasing subsequ...read more
Help your peers!
Add answer anonymously...
SAP Software Developer interview questions & answers
A Software Developer was asked 5mo agoQ. If you have 1 million requests, how will you manage that?
A Software Developer was asked 9mo agoQ. Implement a stack using queues.
A Software Developer was asked 10mo agoQ. Write a function that reverses a string.
Popular interview questions of Software Developer
A Software Developer was asked 5mo agoQ1. If you have 1 million requests, how will you manage that?
A Software Developer was asked 9mo agoQ2. Implement a stack using queues.
A Software Developer was asked 9mo agoQ3. Write a function that reverses a string.
Top HR questions asked in SAP Software Developer
A Software Developer was asked 8mo agoQ1. Introduce yourself.
A Software Developer was asked 10mo agoQ2. What is your top priority when choosing a new job?
A Software Developer was asked 10mo agoQ3. Tell me about your current project and the technologies you are using.
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

