码迷,mamicode.com
首页 > 其他好文 > 详细

Flip Game

时间:2016-07-06 10:12:06      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

 1 public class Solution {
 2     public List<String> generatePossibleNextMoves(String s) {
 3         List<String> result = new ArrayList<>();
 4         if (s.length() < 2) {
 5             return result;
 6         }
 7         
 8         for (int i = 0; i < s.length() - 1; i++) {
 9             if (s.charAt(i) == ‘+‘ && s.charAt(i+1) == ‘+‘) {
10                 result.add(s.substring(0, i) + "--" + s.substring(i+2));
11             }
12         }
13         return result;
14     }
15 }

 

Flip Game

标签:

原文地址:http://www.cnblogs.com/shuashuashua/p/5645811.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!