ByteLandian challenge from CodeChef
If you don't want to recompute the overlapping sub-problems, you could use a cache.

Create the cache in your class:

private HashMap&lt;int, int&gt; resultCache = new HashMap&lt;int, int&gt;();


Then check it at the top of the function:

if (resultCache.contains(goldCoinAmount)) return resultCache.get(goldCoinAmount);


And before returning a result, cache it:

if(goldCoinAmount &gt; totalIntermediate)
    resultCache.put(goldCoinAmount, goldCoinAmount);
    return goldCoinAmount;
else{
    int maxHalfPortion = ByteLandianConversion(halfValue);
    int maxThirdPortion = ByteLandianConversion(thirdValue);
    int maxFourthPortion = ByteLandianConversion(fourthValue);

    int result = maxHalfPortion+maxThirdPortion+maxFourthPortion;
    resultCache.put(goldCoinAmount, result);
    return result;
}


Otherwise, your code is really fairly straightforward and thus fairly readable/maintainable. Readability is far more important than raw performance most of the time.