Let us discuss Longest Increasing Subsequence (LIS) problem as an example problem that can be solved using Dynamic Programming.

The Longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the subsequence are sorted in increasing order. For example, the length of LIS for {10, 22, 9, 33, 21, 50, 41, 60, 80} is 6 and LIS is {10, 22, 33, 50, 60, 80}.

More Examples:

```Input  : arr[] = {3, 10, 2, 1, 20}
Output : Length of LIS = 3
The longest increasing subsequence is 3, 10, 20

Input  : arr[] = {3, 2}
Output : Length of LIS = 1
The longest increasing subsequences are {3} and {2}

Input : arr[] = {50, 3, 10, 7, 40, 80}
Output : Length of LIS = 4
The longest increasing subsequence is {3, 7, 40, 80}```

Java Code:-

```class test{
public static void main(String[] args){
int[] a={3, 10, 2, 1, 20};
int len=a.length;
int[] temp=new int[len];
for(int i=0;i<len;i++){
int cnt=i,lis_cnt=1;
int current_max=a[i];
while(cnt<len){
if(cnt<len-1 && a[cnt+1]>current_max){
current_max=a[cnt+1];
lis_cnt++;
}
cnt++;
}
temp[i]=lis_cnt;
}
int lis_max=0;
for(int i=0;i<len;i++){
if(lis_max<temp[i])
lis_max=temp[i];
}
System.out.println(lis_max);
}
}
```
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://www.beginnertopro.in/post/314", "fetch_time": 1638227008000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2021-49/segments/1637964358847.80/warc/CC-MAIN-20211129225145-20211130015145-00444.warc.gz", "warc_record_offset": 755982398, "warc_record_length": 8682, "token_count": 408, "char_count": 1229, "score": 3.546875, "int_score": 4, "crawl": "CC-MAIN-2021-49", "snapshot_type": "latest", "language": "en", "language_score": 0.652777910232544, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00054-of-00064.parquet"}