Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day 377 #760

Closed
vaskoz opened this issue Dec 1, 2019 · 1 comment · Fixed by #761
Closed

Day 377 #760

vaskoz opened this issue Dec 1, 2019 · 1 comment · Fixed by #761
Assignees

Comments

@vaskoz
Copy link
Owner

vaskoz commented Dec 1, 2019

Good morning! Here's your coding interview problem for today.

This problem was asked by Microsoft.

Given an array of numbers arr and a window of size k, print out the median of each window of size k starting from the left and moving right by one position each time.

For example, given the following array and k = 3:

[-1, 5, 13, 8, 2, 3, 3, 1]

Your function should print out the following:

5 <- median of [-1, 5, 13]
8 <- median of [5, 13, 8]
8 <- median of [13, 8, 2]
3 <- median of [8, 2, 3]
3 <- median of [2, 3, 3]
3 <- median of [3, 3, 1]

Recall that the median of an even-sized list is the average of the two middle numbers.

@vaskoz vaskoz self-assigned this Dec 1, 2019
@vaskoz
Copy link
Owner Author

vaskoz commented Dec 1, 2019

Very similar to #73

@vaskoz vaskoz mentioned this issue Dec 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant