https://github.com/ctsrc/dp
Dynamic Programming problems and solutions
https://github.com/ctsrc/dp
Last synced: about 1 year ago
JSON representation
Dynamic Programming problems and solutions
- Host: GitHub
- URL: https://github.com/ctsrc/dp
- Owner: ctsrc
- Created: 2021-07-21T22:18:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-25T02:11:34.000Z (over 2 years ago)
- Last Synced: 2025-01-09T05:56:28.631Z (about 1 year ago)
- Language: Rust
- Size: 23.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dynamic programming problems and solutions
Dynamic programming \[...\] refers to simplifying a complicated problem
by breaking it down into simpler sub-problems in a recursive manner.
https://en.wikipedia.org/wiki/Dynamic_programming
## Table of Contents
* [Highlighted problems and solutions](#highlighted-problems-and-solutions)
* [Mo' money 🤑 🤑 🤑 mo' problems 😩 😩 😩](#mo-money----mo-problems---)
## Highlighted problems and solutions
### [Stockmax](stockmax)
Your algorithms have become so good at predicting the market that you now know
what the share price of Wooden Orange Toothpicks Inc. (WOT) will be
for the next number of days.
Each day, you can either buy one share of WOT, sell any number of shares of WOT
that you own, or not make any transaction at all. What is the maximum profit
you can obtain with an optimum trading strategy?
[READ MORE](stockmax)
```bash
cargo test --release --doc -p stockmax
```
```text
running 3 tests
test src/lib.rs - stockmax (line 7) ... ok
test src/lib.rs - stockmax (line 3) ... ok
test src/lib.rs - stockmax (line 11) ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
```
```bash
cargo run --release stockmax < stockmax/test/input/input11.txt
```
```text
6
4
```
## Mo' money 🤑 🤑 🤑 mo' problems 😩 😩 😩
This section lists problems and solutions that were not
interesting enough to deserve highlighting.
Currently there are no problems and solutions in this section.
Mainly because only one problem has been solved so far.
And partly because not interesting problems are also not so
interesting to solve so I might decide not to solve them
in the first place.