Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
1 like 0 dislike
in Online Assessments by Expert (111,530 points) | 806 views

1 Answer

0 like 0 dislike
Tan is a school teacher. Her manager Taru asks her to bring the maximum number of students from his class where there are at max X pair of adjacent students whose heights is not the same. In similar words Tan has to find the maximum number of students standing in ascending order of their height such that there are only X adjacent pair of students whose height are not the same.


1<=array element <=1000


What could be the optimal solution?




we can take 1,1,2 or 1,1,3
by Expert (111,530 points)

Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .