TC 1 is failing

Pls check my TC 1 is failing…

hey abhijeet have u seen my code

yes i will reply as soon i find the error , dont worry i am on it

1 Like

thnx bro…

hi @soumakpoddar55, your logic is correct but since the input can be as large as 10^8 thus you can’t allocate that much space in an array . as lot of space is getting unused if you denote array of size n .so, do this question using memoization . this will pass . i will share the code snippet

map <int, int64> memo;

int64 solve (int n) {
    if (n == 0 || n == 1) return n;
    if (memo.count (n)) return memo [n];
    int64 ret = n;
    ret = max (ret, solve (n / 2) + solve (n / 3) + solve (n / 4));
    return memo [n] = ret;
}

for int_64 what header file should I use???

will work fine with iostream alone you can use long long

getting error bro…can u pls send me the code

wait let me share u an easier code

refer this : https://ide.codingblocks.com/s/229588