4
mundo03
7y

I took a hakerRank challenge for an interview, I failed miserably.

All challenges included subsequences and I just kept reaching memory limit... My algorithm gets the answer, if just takes forever if the input is too large.

So fuck stupid me.
I am now googling about it but can not find something that explains it clear (in my opinion)

Would appreciate if you guys can recommend some resources.

Comments
  • 0
    What was the problem?
  • 1
    @Cruiser input k ,array
    Where k is int.

    Get the size of the largest subsequence which sum <= k

    I used very few lines, used reduce, map and each_cons(size) to do the job, but that means thay a very big array will try tu sum a LOT of sequences hence memory runs out :(

    Apparently I should have used a dynamic programming algorithm​, which I just know the name off. :(
Add Comment