Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions p6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Problem

Find out all LCS of《ABACABAC》and《CABCBAAB》.

# Solution

## Example

解LCS所設計的遞迴公式:

```c
c[i, j] = 0 if i = 0 or j = 0
= c[i-1, j-1] + 1 if i, j > 0 and x_𝑖 = y_𝑖
= max(c[i, j-1], c[i-1, j]) if i, j > 0 and x_i ≠ y_j
```

![LCS Length Table](https://i.imgur.com/VeUrq5b.jpg)

- ABAAB
- ABCAB
- ABCAA
- ABCBA