-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add smallest sum #13
base: main
Are you sure you want to change the base?
Add smallest sum #13
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,19 @@ | ||||||||||||||||||||||||||||||||||||
# Smallest Sum | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
## Question | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Here is the problem statement: | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Given a list of integers, you will need to find sum that can be created for a given list. For example, if the list was [1,6,9,4,3], the smallest sum of the list would be 4(3+1). Below is a way that you could go about finding smallest sum in an array: | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool question! Maybe try making the problem more clear. It could maybe be confusing in the first sentence where it says "you will need to find sum that can be created for a given list." Later in the sentence it is mentioned about smallest sum, maybe try adding that near the beginning to make idea more clear :) |
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
for(i in range(0,array.length)){ | ||||||||||||||||||||||||||||||||||||
for(j in range(0,array.length)){ | ||||||||||||||||||||||||||||||||||||
if((array[i]+array[j])<minSum){ | ||||||||||||||||||||||||||||||||||||
minSums = (array[i]+array[j]) | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
Comment on lines
+10
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could use the 3 backticks to format it in a nicer way |
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Create a solution to solving this problem efficiently. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is a little bit unclear. Maybe explaining why
4(3+1)
is the solution could help!