Given an array, find the maximum of all subarrays of size k with O(N) time complexity. Input: arr[] = {1, 2, 3, 1, 4, 5, 2, 3, 6}, k = 3. Output: 3 3 4 5 5 5 6

AnswerBot
1y
Find the maximum element in each subarray of size k in a given array.
Iterate through the array from index 0 to n-k.
For each subarray of size k, find the maximum element.
Store the maximum elements in a...read more
Anonymous
2y
Bajaj Finance click here 📞 082.92.32.04.14📱
Help your peers!
Add answer anonymously...
Amazon Software Developer interview questions & answers
A Software Developer was asked 1mo agoQ. Could you describe the process for designing a data structure that allows for al...read more
A Software Developer was asked 1mo agoQ. What is MySQL?
A Software Developer was asked 1mo agoQ. What is Java?
Popular interview questions of Software Developer
A Software Developer was asked 1mo agoQ1. Could you describe the process for designing a data structure that allows for al...read more
A Software Developer was asked 1mo agoQ2. What is MySQL?
A Software Developer was asked 1mo agoQ3. What is Java?
Top HR questions asked in Amazon Software Developer
A Software Developer was asked 1mo agoQ1. Tell me about a time you had to get to the root cause of a problem
A Software Developer was asked 5mo agoQ2. What are the short-term and long-term goals for the team or organization?
A Software Developer was asked 5mo agoQ3. Why do you want to work at Amazon?
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

