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

Implement a brute-force recursive function bool can_sum(int target_value, const int *numbers); #13

Closed
SchattenMonarch opened this issue Aug 29, 2022 · 1 comment

Comments

@SchattenMonarch
Copy link
Owner

Return values:

  • true: if it is possible to generate the target_value by summing the elements in the array.
  • false: if it is not possible.

Samples

Sample 1

can_sum(7, [5, 3, 4, 7]) -> true

because there are three possible solutions: 3+4, 4+3 and 7.

Sample 2

can_sum(7, [2, 4]) -> false

because it's impossible to build a 7 with the numbers in the array.

@SchattenMonarch SchattenMonarch changed the title Implement a brute-force recursive function bool can_sum(int target_value, const int *numbers); Implement a brute-force recursive function C bool can_sum(int target_value, const int *numbers); Aug 29, 2022
@SchattenMonarch SchattenMonarch changed the title Implement a brute-force recursive function C bool can_sum(int target_value, const int *numbers); Implement a brute-force recursive function bool can_sum(int target_value, const int *numbers); Aug 29, 2022
@SchattenMonarch SchattenMonarch self-assigned this Aug 29, 2022
@SchattenMonarch SchattenMonarch added the C C language label Aug 29, 2022
@SchattenMonarch SchattenMonarch changed the title Implement a brute-force recursive function bool can_sum(int target_value, const int *numbers); Implement a brute-force recursive function bool can_sum(int target_value, const int *numbers); Aug 29, 2022
@SchattenMonarch
Copy link
Owner Author

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant