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

Ports - Faiza #19

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

Ports - Faiza #19

wants to merge 1 commit into from

Conversation

Faiza1987
Copy link

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.

This definitely works and with the space & time complexity you listed. There is a counterintuitive way to solve the problem without the sets you used, instead using the 1st row and 1st column to store the row and columns to zero out. However this is a good solution. Nice work.

end

row_set.each_with_index do |k|
for l in (0...matrix[k].length)

Choose a reason for hiding this comment

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

Two questions:

1). Why use .each_with_index for the outer loop if you don't end up using the index variable.
2). Why use a for-in loop here if you do an each with index for the outer loop?

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