Good morning! Here's your coding interview problem for today.
This problem was asked by Google.
Given an array of integers and a number k, where 1 <= k <= length of the array,
compute the maximum values of each subarray of length k.
For example, given array = [10, 5, 2, 7, 8, 7] and k = 3, we should get: [10, 7,
8, 8], since:
10 = max(10, 5, 2)
7 = max(5, 2, 7)
8 = max(2, 7, 8)
8 = max(7, 8, 7)
Do this in O(n) time and O(k) space. You can modify the input array in-place and
you do not need to store the results. You can simply print them out as you
compute them.
Good morning! Here's your coding interview problem for today.
This problem was asked by Google.
Given an array of integers and a number k, where 1 <= k <= length of the array, compute the maximum values of each subarray of length k.
For example, given array = [10, 5, 2, 7, 8, 7] and k = 3, we should get: [10, 7, 8, 8], since:
Do this in O(n) time and O(k) space. You can modify the input array in-place and you do not need to store the results. You can simply print them out as you compute them.
Upgrade to premium [http://links.dailycodingproblem.com/wf/click?upn=-2F03iMydR750DKx07F4BRwWErdzWeRmfVcT48gFYejU-2Bz6QcOxyCKetP6lYnXnpQi4KDQjG5YX4vCNlX3sdbfos06VT5YoRFkg4TrA1RVZWv0DZHacVnT6CRVrZdYdIbA_iscjqzEYz8RolbSgMQLtCXgsn2DW3ZG-2FJEHwGBaE-2FdXPYLgPD7QeHeMl-2FGCW0onJYkqZ22Bc-2BEoG-2B-2FOrvueVTo-2BsMMYlaVK-2BBoa4un-2FdSTyk8Pau6WU-2FxmtyQmYyZos6t7lQdXlnglu4WTKyWsjBU5QHeYj-2B1DCgByyJCzZFZtaS-2FBqqbXfNiw8G0Qm49zfAcIWD2LbVzQUfbS-2FvTXOwKb-2BnMyH7lxpcfkUTNLNFAf4-3D] and get in-depth solutions to every problem.
If you liked this problem, feel free to forward it along! As always, shoot us an email if there's anything we can help with!
No more? Unsubscribe [http://links.dailycodingproblem.com/wf/click?upn=-2F03iMydR750DKx07F4BRwTq4x5HkPwxRhpDWfk1b7nXvgvDhSC78LLls-2Bvqs1KQvHGZzlxUHjTKmlyywaw1SP8zvxacCSMPWWHMDKM6wdS5Jl1I3MW0lfGAMY6ZLmyd0PQd5Ii-2F27lf3r61PXBXKc4STUNjbJNoKX2Dov-2Fr9Cag7e39ot-2F6XWTzq2lck7ESA_iscjqzEYz8RolbSgMQLtCXgsn2DW3ZG-2FJEHwGBaE-2FdXPYLgPD7QeHeMl-2FGCW0onJYkqZ22Bc-2BEoG-2B-2FOrvueVTv-2Bd3IxSUXO-2FiP5RgKzClsi3Vt0JU72takQ-2By19Njrt8BrsL7pXS4F73n0dVhAf4-2BHhytg6qsE-2Fh-2BIJa5cNzsCQgYr-2BMgmnHBYYP3dKUmUO9tDz0-2B-2FEpimTmMAhUlqGmdgBw9t2-2BZoEIFG6u15LZCzE-3D] .