You are viewing a single comment's thread. Return to all comments →
Same logic with recursion approach:
private static int viralAdvertising(int n, int days) { return ( days == 0 ) ? 0 : ((n >> 1) + viralAdvertising(((n >> 1) * 3), --days)); }
Seems like cookies are disabled on this browser, please enable them to open this website
Viral Advertising
You are viewing a single comment's thread. Return to all comments →
Same logic with recursion approach: