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

Optimized encrypt.py python script #4

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

Optimized encrypt.py python script #4

wants to merge 2 commits into from

Conversation

AOrps
Copy link

@AOrps AOrps commented Mar 20, 2021

Purpose

  • Optimize Script to run faster

Details

  • I noticed that this code ran at O(n) just fine but was instead running at O(n^2) because it was trying to convert a multi-dimensional array into a string. So I just eliminated some abstractions of the script, that might prove costly to large test cases

Technical Details

fence = ["" for i in range(n) ]
  • Instead of doing a list comprehension on a list in python (which creates a multi-dimensional list), you can do one with a string. Which then allows for one iteration the list as opposed to 2.
return "".join(fence)
  • This is used to join all the strings of the list together as one string.

@CLAassistant
Copy link

CLAassistant commented Mar 20, 2021

CLA assistant check
All committers have signed the CLA.

@AOrps
Copy link
Author

AOrps commented Mar 23, 2021

I haven't the slightest idea of why the checks aren't passing but let me know what to fix so I can update it accordingly whenever the maintainer of this repository gets the chance!

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