I am working to solve a problem that is a bit similar to Euler Problem 215. I think I can explain this without explaining the entire problem and/or my full approach to solving it.
Right now I'm making recursive calls with RT([Arraylist of numbers], int i). As per the technique, I want to save the results, so if and when RT asks for the same problem, I can simple just look up the answer instead of recurring until the base case is reached.
Just to illustrate RT([3, 7.5, 10.5, 15], 2). In the recursion, the right in the right side to increment. The Arraylist is used to identify what else it needs to recall to the base case.
Usaully, my understanding of Dynamic Programming usually uses 2D Arrays where the results are saved and stored using what's being called as the reference point. This is great if it is something like RT(int x, int y). But what about my problem?
I guess I can change the ArrayList to a string 37510515 and then to some used ASCII numbers or perhaps the numbers itself. But I'm hoping I can approach this like a HashMap where I use the ArrayList as a key, but the flaw in this a HashMap only works well with one value (I know I can chain, but how would that work in storing results while easily keeping track of what "int i" it is called on?)
So in short, can anyone help me think of a way to store results with an ArrayList and an int as the two references?
Thanks in advance!