22 lines
795 B
Markdown
22 lines
795 B
Markdown
|
# Maximum profit
|
||
|
|
||
|
Puzzle from [rendezvous with cassidoo](https://buttondown.email/cassidoo/archive/the-thermometer-of-success-is-merely-the-jealousy/) newsletter, July 23rd 2023.
|
||
|
|
||
|
Implementation in ANSI BASIC with prototype in Python.
|
||
|
|
||
|
Solution posted at https://strangeobject.space/@ooze/110770674393278897
|
||
|
|
||
|
## How to run
|
||
|
|
||
|
Edit the last `DATA` statement from the `MAXPROFIT.BAS` file to specify the sequence. Update the loop counter on line
|
||
|
20 to the number of elements in that sequence.
|
||
|
|
||
|
Running the code requires a BASIC intepreter such as [Bywater BASIC](https://github.com/nerun/bwbasic/) (bwBASIC). For
|
||
|
example, on Ubuntu, Debian, or Pop! OS systems, it can be installed from `apt install bwbasic`.
|
||
|
|
||
|
```console
|
||
|
bwbasic MAXPROFIT.BAS
|
||
|
```
|
||
|
|
||
|
Exit the interactive environment by typing Ctrl-D.
|