-
Notifications
You must be signed in to change notification settings - Fork 29
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
Swift Language #69
base: master
Are you sure you want to change the base?
Swift Language #69
Conversation
|
||
func generateMatrix(n: Int) -> [[Int]] { | ||
var res = Array<[Int]>(repeating: Array<Int>(repeating: 0, count: n), count: n) | ||
var k = 1, i = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please give some meaningful names to i, j & k.
var k = 1, i = 0 | ||
while k <= n * n { | ||
var j = i | ||
while j < n - i { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearly you are going to the right. Please add a comment before each while loop so people can easily understand your logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. Only presentation needs to be improved.
Hi @larrypham, thanks for submitting PR. Going forward, I would like you to submit 1 solution per 1 feature branch. Please avoid using For the next submissions, please follow the guide in the video: |
No description provided.