×

# How to solve Bytelandian gold coin ?

 0 question This is my solution to the problem. Can anyone tell me what is wrong with it ? solution asked 01 Sep '18, 21:12 1★ak1010 1 accept rate: 0%

 0 You're not attempting to convert the coins that you get from converting the first one (and so on). In the first example below: $40 \to 20 + 13 + 10 \to (10 + 6 + 5) + 13 + 10 = 44$ Some more test cases for you: 40 50 60 400  output: 44 57 68 533  answered 02 Sep '18, 01:42 5★joffan 948●8 accept rate: 13%
 0 @joffan this is my code code Approach i used is: if (n<12) max_value=n, else: max_value = calc_max(n/2) + calc_max(n/3) + calc_max(n/4) along with saving the entries in HashMap with each value of n Test cases mentioned above have passed, but the problem is when I submit this code, it gives me TLE. I ran the code in my local system, gave output of 4243218150, for input: 1000000000 in around 30 seconds. Can you or anyone help me out here ? answered 26 Oct '18, 11:34 1★akki0214 1●1 accept rate: 0% no worries, there was a minor issue, i was not returning from recursive call, when getting value from map, its solved now (27 Oct '18, 12:49) akki02141★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×2,559
×29
×18

question asked: 01 Sep '18, 21:12

question was seen: 217 times

last updated: 27 Oct '18, 12:49