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

[Challenge] Sum Arrays #47

Closed
parhaml opened this issue Apr 21, 2021 · 4 comments · Fixed by #48
Closed

[Challenge] Sum Arrays #47

parhaml opened this issue Apr 21, 2021 · 4 comments · Fixed by #48
Labels
proposed challenge An idea for a future challenge

Comments

@parhaml
Copy link
Collaborator

parhaml commented Apr 21, 2021

Sum Arrays

Given an array of values, return the sum of the values.

Business Rules/Errata

  • Input must be an array.
  • The array may be nested more than one level.
  • All values must be integers.
  • Solutions shall not use built in methods to flatten the array to one-dimension.

Examples

One dimension:

sum_of_array([1,2,3,4,5]) => 15

Two dimensions:

sum_of_array([1,2,[1,2,3],4,5]) => 18

n dimensions:

sum_of_array([1,[1,2,[3,4],5],[6,7]]) => 29
@parhaml parhaml added the proposed challenge An idea for a future challenge label Apr 21, 2021
@ericwburden
Copy link
Collaborator

Ah man, this one is really hard! (Assuming you use a statically typed language that doesn't natively support arbitrarily nested arrays).

@parhaml
Copy link
Collaborator Author

parhaml commented Apr 21, 2021

Ah man, this one is really hard! (Assuming you use a statically typed language that doesn't natively support arbitrarily nested arrays).

That's an interesting point. Perhaps it's for later or for a subset of languages.

@jcsmileyjr
Copy link

This is a true challenge

@parhaml
Copy link
Collaborator Author

parhaml commented Apr 22, 2021

It should be fun!

@parhaml parhaml linked a pull request Apr 23, 2021 that will close this issue
@ericwburden ericwburden linked a pull request May 17, 2021 that will close this issue
@ericwburden ericwburden removed a link to a pull request May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposed challenge An idea for a future challenge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants