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

check matrix sum #16

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

Conversation

BarbaraWidjono
Copy link

Time complexity: O(n^2), assuming the matrix to check is always a square. We must iterate through each value in the matrix to sum the row and sum the column.
Space complexity: O(1), no extra memory is needed since we are only using 2 variables to keep track of the row_sum and column_sum per given iteration of the loop.

# return true (iterated through entire matrix with corresponding rows and columns equal to eachother)

end
return true
raise NotImplementedError

Choose a reason for hiding this comment

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

Line 36 is dead code and should be safely deleted.

@shrutivanw
Copy link

Nice work!

Minor: explain what n stands while explaining your time or space complexities in terms of n.

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