Skip to main content

All Questions

Tagged with
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 ...
Elias El hachem's user avatar
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 ...
J. Toulmonde's user avatar
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 ...
Togepi's user avatar
  • 117
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 ...
kumarmo2's user avatar
  • 261
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 (...
Der Kommissar's user avatar
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 ...
user avatar
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. ...
VIckyb's user avatar
  • 665
6 votes
1 answer
3k views

Memoized Fibonacci

I went ahead and implemented a method to calculate Fibonacci numbers using memoization. ...
skiwi's user avatar
  • 10.7k
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 ...
Paul Bellora's user avatar
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 ...
mindas's user avatar
  • 171