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

Swift Language #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Swift Language #69

wants to merge 2 commits into from

Conversation

larrypham
Copy link

No description provided.


func generateMatrix(n: Int) -> [[Int]] {
var res = Array<[Int]>(repeating: Array<Int>(repeating: 0, count: n), count: n)
var k = 1, i = 0
Copy link
Member

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 {
Copy link
Member

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.

Copy link
Member

@vietlq vietlq left a 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.

@vietlq
Copy link
Member

vietlq commented Nov 11, 2016

Hi @larrypham, thanks for submitting PR. Going forward, I would like you to submit 1 solution per 1 feature branch. Please avoid using master for this kind of work.

For the next submissions, please follow the guide in the video:

https://www.facebook.com/Code2Pro/videos/355616664771172/

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