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

C17/CSFunA/HumaHameed #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"."
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
12 changes: 11 additions & 1 deletion lib/newman_conway.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@ def newman_conway(num):
Time Complexity: ?
Space Complexity: ?
"""
pass
values = []
if num < 1:
raise ValueError("Please enter a positive number.")
for i in range(1,num+1):
values.append(dp(i, values))
return " ".join(map(str, values))

def dp(num, values):
if num == 1 or num ==2:
return 1
return values[values[num-2]-1]+values[num - values[num-2]-1]