All Questions
Tagged with memoization java
10 questions
5
votes
3
answers
957
views
LeetCode 678: Valid Parenthesis String, Recursion memoization to DP
How can the following recursion + memoization code be converted into a tabulation format dynamic programming solution?
The code is working, but I want to improve it.
The challenge I am facing is ...
2
votes
1
answer
64
views
Number of way to render an amount of money
I made an algorithm to train my skill in dynamic programming and I would like to have feed back on it. This algorithm takes a money system (int) and have a certain ...
1
vote
1
answer
460
views
Recursive Fibonacci in Java
I just started learning recursion and memoization, so I decided to give a simple implementation a shot. Works with some simple test cases I came up with. Is there anything I can add to make this more ...
2
votes
2
answers
280
views
Transform String a into b
You can perform the following operation on some string a:
Capitalize zero or more of a's lowercase letters at some index i (i.e., make them uppercase).
Delete all of the remaining lowercase ...
6
votes
1
answer
626
views
Locating the largest Collatz Sequence with memoization
Inspired by this question I wrote a memoized form of the collatz sequence calculator.
The idea was to cache the sequence lengths for as many sequences as possible, from 0 to some value. I managed to (...
3
votes
1
answer
4k
views
Google Foobar Level 3 - Lucky Triples (Find the Access Codes)
I have been working on this problem for 3 days now. I wrote a piece of java code that works perfectly on my machine testing in Eclipse, but when I put it in Foobar, it either returns "Error(400) Bad ...
12
votes
5
answers
7k
views
Dynamic programming with Fibonacci
I have written the following code using a dynamic programming technique. Can I use ArrayList here? Please let me know if I can improve this code.
...
6
votes
1
answer
3k
views
Memoized Fibonacci
I went ahead and implemented a method to calculate Fibonacci numbers using memoization.
...
7
votes
2
answers
546
views
Helper class to memoize DateFormats application-wide
Premise
Consider the following method:
static String formatMyDate(Date date) {
return new SimpleDateFormat("yyyy-MM-dd").format(date);
}
It's often ...
7
votes
1
answer
4k
views
Ability to forget the memoized supplier value
Guava has a feature request which is asking to provide the ability to forget memoized value on a given supplier.
On top on that I needed another functionality where if during the calculation of ...