非对称之美(贪心) import java.util.*;
public class Main{public static void main(String[] arg) {Scanner in new Scanner(System.in);char[] ch in.next().toCharArray(); int n ch.length; int flag 1;for(int i 1; i < n; i) {if(ch[i] ! ch[0]) {flag …
题目: 解析: 代码: public int getMaxLen(int[] nums) {int n nums.length;int[] f new int[n1];int[] g new int[n1];int ret -0x3f3f3f3f;for(int i 1; i < n; i){if(nums[i-1] < 0){f[i] g[i-1] 0 ? 0 : g[i-1] 1;g[i] …