Flip Game
https://leetcode.com/problems/flip-game/
public List<String> generatePossibleNextMoves(String s) { List<String> res=new ArrayList<String>(); if(s==null||s.length()<2){ return res; } for(int i=0;i<=s.length()-2;i++){ if(s.charAt(i)=='+'&&s.charAt(i)==s.charAt(i+1)){ res.add(s.substring(0,i)+"--"+(i+2<s.length()?s.substring(i+2):"")); } } return res; }

浙公网安备 33010602011771号