Suppose there is an unsorted array. What will be the maximum window size, such that when u sort that window size, the whole array becomes sorted. Eg, 1 2 6 5 4 3 7 . Ans: 4 (6 5 4 3)

AnswerBot
1y

Find the maximum window size to sort an unsorted array.

  • Identify the longest decreasing subarray from the beginning and longest increasing subarray from the end

  • Find the minimum and maximum element in t...read more

Nikhil Sankhla
2y

Create 2 Variables

sum=0 and max_sum=arr[0]

Now start a for loop to travel the array

add every item in sum and compare with the max_sum, if the max_sum goes smaller then zero then only convert max_sum...read more

Help your peers!
Add answer anonymously...
Adobe Member Technical Staff Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter