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

293.Flip Game

时间:2016-07-03 06:59:54      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

    /*
     * 293.Flip Game
     * 2016-7-2 by Mingyang
     * 第一题是很简单的
     */
    public List<String> generatePossibleNextMoves(String s) {
        List<String> res=new ArrayList<String>();
        int len=s.length();
        if(s==null||len==0)
          return res;
        for(int i=0;i<len-1;i++){
            StringBuffer sb=new StringBuffer(s);
            if(s.charAt(i)==‘+‘&&s.charAt(i+1)==‘+‘){
                sb.setCharAt(i,‘-‘);
                sb.setCharAt(i+1,‘-‘);
                res.add(sb.toString());
            }
        }
        return res;
    }

 

293.Flip Game

标签:

原文地址:http://www.cnblogs.com/zmyvszk/p/5636471.html

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