8
votes
1answer
5k views

Find all subsets of an int array whose sums equal a given target

I am trying to implement a function below: Given a target sum, populate all subsets, whose sum is equal to the target sum, from an int array. For example: ...
3
votes
5answers
388 views

count all array[index] == index occurrences

The method foo gets a sorted list with different numbers as a parameter and returns the count of all the occurrences such that: ...
1
vote
1answer
234 views

Pure PHP array_diff_assoc_recursive function

For my application, I was using array_diff_assoc, when I noticed it was returning the wrong value. I was using multidimensional arrays, therefore I needed a ...
3
votes
0answers
207 views

Implementing recursive filters with Haskell/Repa

I recently learned Haskell, and I am trying to apply it to the code I use in order to get a feeling for the language. I really like the Repa library since I manipulate a lot of multi-dimensional ...
6
votes
4answers
3k views

Getting the largest element in an array using recursion

Any suggestions on how to make this code more efficient? ...