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

Time complexity of the solution to TextJustification seems to be O(n)? #206

Closed
DaiYue opened this issue Feb 21, 2017 · 1 comment
Closed

Comments

@DaiYue
Copy link
Contributor

DaiYue commented Feb 21, 2017

I'm wondering that the time complexity of this solution is O(n) rather than O(n^2) ? Seems that each letter is visited and output for just once.

Also I'm curious why the 2 functions _buildLine and _buildSpecialLine has a "_" prefix? Is it because they are private methods and this is some kind of a coding convention? Thanks a lot:)

@soapyigu
Copy link
Owner

You are right, i guess it is O(n). And the underline prefix is to follow my old java style from my earlier job - all private methods should be named with underline as prefix. I will fix it later, thank you.

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

No branches or pull requests

2 participants