A real strategy to invest
If you want to invest on a project [x,y], you must have y money. Once finished, you gain y-x money. So, which project you should invest first to build up a good
If you want to invest on a project `[x,y]`, you must have `y` money. Once finished, you gain `y-x` money. So, which project you should invest first to build up a good capital for the next investments?\n\nMy advice is to invest on projects which are able to bring back the highest profitability `y-x`. Even, in the case `y` is very big, don\'t be afraid, you can loan extra money from other sources (banks, family, friends) to have enough `y` money. The secret is you know that at this moment, `y-x` is the most profitable.\n\nSo, we can arrange the projects by decreasing profits, and borrow money to invest if our capital is not enough.\n\n```\n\t\tint res = 0, cur = 0;\n        Arrays.sort(A, (a, b) -> (b[1] - b[0]) - (a[1] - a[0]));\n                        \n        for (int[] a : A) {\n            if (cur < a[1]) {        // current capital not enought to invest?\n                res += a[1]-cur;     // borrow\n                cur = a[1];\n            }\n            cur -= a[0];             // gained profit\n        }\n        return res;\n```\n\nNow, we can apply this strategy in real life. Tell me on what we should invest now? `gold`, `stock`, `bitcoin`, etc...
[]