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

[python]challenge_[6](Pending) #225

Merged
merged 10 commits into from
Jan 7, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Python]Challenge_7(Unreviewed)
  • Loading branch information
MJUIUC committed Jan 7, 2017
commit fae170d5b859709b94cc24542170d71f03ac69a8
5 changes: 5 additions & 0 deletions challenge_7/python/mjuiuc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Solution

I think I got it figured out. All I had to do was take the sum of the length of the list and then the sum of all the numbers in the list, find the difference betweend those results, and then return the difference modded by the length of the list. The function meets runtime and space requirements.

I included some test cases in my solution.
9 changes: 9 additions & 0 deletions challenge_7/python/mjuiuc/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def solution(nums):
n = len(nums) + 1
sums = 0
Summation = 0
for i in nums:
sums += i
for i in xrange(0,n+1):
Summation += i
return (Summation - sums) % n
28 changes: 28 additions & 0 deletions challenge_7/python/mjuiuc/test.py

Large diffs are not rendered by default.