293.Flip Game

    /*
     * 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;
    }

 

相关文章:

  • 2021-04-30
  • 2022-03-05
  • 2021-07-31
  • 2021-06-30
  • 2021-07-07
  • 2021-11-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2022-02-04
  • 2022-12-23
  • 2022-02-19
相关资源
相似解决方案