Skip to content

Sockets - Amy#12

Open
aphunk wants to merge 1 commit intoAda-C11:masterfrom
aphunk:master
Open

Sockets - Amy#12
aphunk wants to merge 1 commit intoAda-C11:masterfrom
aphunk:master

Conversation

@aphunk
Copy link
Copy Markdown

@aphunk aphunk commented May 2, 2019

No description provided.

Copy link
Copy Markdown

@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.

# Space complexity: ?
def matrix_convert_to_zero(matrix)
raise NotImplementedError
new_matrix = []
Copy link
Copy Markdown

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|
Copy link
Copy Markdown

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