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

challeng7 in python #386

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

challeng7 in python #386

wants to merge 6 commits into from

Conversation

py2k5
Copy link
Contributor

@py2k5 py2k5 commented Jan 12, 2017

No description provided.

print 0
else:
for num in numbers:
if num +1 < tot and num+1 not in numbers:
Copy link
Contributor

Choose a reason for hiding this comment

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

'num + 1 not in numbers is O(n), and you put it in the for loop, together it's O(n square) complexity?

@ManuelMeraz
Copy link
Contributor

ManuelMeraz commented Jan 13, 2017

@py2k5

  • Code Correctness
    Your challenge 7 solution needs to be worked on. I think it's just a misunderstanding of how the statement if i in list works. To confirm whether something is in a list this statement will iterate through your list until it finds the number, then check the next number and iterate through the list again, until the first for loop finishes. In a sense you have 2 nested for loops each dependent on the length of the input to find the missing number making this O(N^2). See if you can improve on this algorithm.
  • Code Style
  • Code Documentation
  • Path Structure
  • Merge Pull Request

@py2k5
Copy link
Contributor Author

py2k5 commented Jan 13, 2017 via email

@ManuelMeraz
Copy link
Contributor

@py2k5 We can help you in the slack chat if you'd like or I can give you some hints here as well on how to improve. I'd also recommend looking at some of the other python solutions for this challenge.

@py2k5
Copy link
Contributor Author

py2k5 commented Jan 13, 2017 via email

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.

None yet

3 participants