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

Sockets - Amy #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Sockets - Amy #12

wants to merge 1 commit into from

Conversation

aphunk
Copy link

@aphunk aphunk commented May 2, 2019

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, you solved the problem, and you solved it with two external arrays. This definitely works, but you could draw down the memory usage a bit. You can see my inline comments and let me know if you have questions on it.

@@ -6,5 +6,31 @@
# Time complexity: ?
# Space complexity: ?
def matrix_convert_to_zero(matrix)
raise NotImplementedError
new_matrix = []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think the space & time complexities are?

rows_w_0 = {}
cols_w_0 = {}

matrix.length.times do |x|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definitely works, but you could also use the 0th index of the row and columns to serve the same role as the rows_w_0 and cols_w_0 arrays.

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 this pull request may close these issues.

2 participants