标签:
1 public class Solution { 2 public boolean canWin(String s) { 3 if (s.length() < 2) { 4 return false; 5 } 6 List<String> result = new ArrayList<>(); 7 for (int i = 0; i < s.length() - 1; i++) { 8 if (s.charAt(i) == ‘+‘ && s.charAt(i+1) == ‘+‘) { 9 result.add(s.substring(0, i) + "--" + s.substring(i+2)); 10 } 11 } 12 for (String next : result) { 13 if (!canWin(next)) { 14 return true; 15 } 16 } 17 return false; 18 } 19 }
标签:
原文地址:http://www.cnblogs.com/shuashuashua/p/5646725.html