【在 a****a 的大作中提到】 : Print all the increasing subsequence from the given range 54782369862345 .. : ex: 5,7,8,9; 4,7,8,9; 2,3,6,9 .. : 这个题除了brute forth解法外,还有什么巧妙的解法吗?欢迎大家赐教~
I've see a similar question before, just cannot figure it out. come from http://blog.csdn.net/v_july_v/article/details/6870251 求一个数组的最长递减子序列比如{9,4,3,2,5,4,3,2}的最长递减子序列为{9, 5, 4,3,2} ANSWER: Scan from left to right, maintain a decreasing sequence. For each number, binary search in the decreasing sequence to see whether it can be substituted. int[] findDecreasing(int[] a) { int[] ds = new int[a.length]; Arrays.fill(ds, 0); int dsl = 0; int lastdsl = 0; for (int i=0; i// binary search in ds to find the first element ds[j] smaller than a[i] . set ds[j] = a[i], or append a[i] at the end of ds int s=0, t=dsl-1; while (s<=t) { int m = s+(t-s)/2; if (ds[m] < a[i]) { t = m - 1; } else { s = m + 1; } } // now s must be at the first ds[j]ds[s] = a[i]; if (s > dsl) { dsl = s; lastdsl = i; } } // now trace back. for (int i=lastdsl-1, j=dsl-1; i>=0 && j >= 0; i--) { if (a[i] == ds[j]) { j --; } else if (a[i] < ds[j]) { ds[j--] = a[i]; } } return Arrays.copyOfRange(ds, 0, dsl+1); }
b*n
14 楼
What is the exact problem you have about "很多网站比如文学城字体显示都有问题 "? I don't recall that I had any issue when I used my 1st generation Kindle Fire. I do agree that KF's 7" screen(16:9) is much smaller than my other 10"screen (4:3) Lenovo tablet(S2109).
【在 y*****n 的大作中提到】 : I've see a similar question before, just cannot figure it out. come from http://blog.csdn.net/v_july_v/article/details/6870251 : 求一个数组的最长递减子序列比如{9,4,3,2,5,4,3,2}的最长递减子序列为{9, : 5, : 4,3,2} : ANSWER: : Scan from left to right, maintain a decreasing sequence. For each number, : binary search in the decreasing sequence to see whether it can be : substituted. : int[] findDecreasing(int[] a) { : int[] ds = new int[a.length];
If by 自动伸展, you mean text re-flow, you need to change a few setting in the default Amazon silk browser so text re-flow works well. Certainly you can also download and install Opera Mini browser on Kindle Fire without tweaking the setting.
【在 s*********e 的大作中提到】 : kinder fire 碰到很多网页不能自动伸展,所以文学城首页上那些新闻标题都只能显示 : 一部分。 : 广告到一条不少。