/stock-analysis

Stock Buy Sell to Maximize Profit - past as well as future

Primary LanguagePHP

stock-analysis

Stock Buy Sell to Maximize Profit - past as well as future

The cost of a stock on interval of time is given in an array, find the max profit that you can make by buying and selling in those days. For example, if the given array is [[time, value,[time, value]]], the maximum profit can earned by buying on day 0, selling on day 3. Again buy on day 4 and sell on day 6. If the given array of prices is sorted in decreasing order, then profit cannot be earned at all.

Step need to do after installation of laravel setup: -> run the db migration command i.e. php artisan migrate -> run the db seeder command i.e. php artisan db:seed, you will see the seed data for master data and stock data I.e. https://portal-widgets-v3.foreks.com/periodic-tabs/data -> need to login from either your email or my email/secret RUN on CMD: composer dump-autoload (optional) RUN on CMD/CLI ./vendor/bin/phpunit enter (optional) for UNIT test