You are playing the following Flip Game with your friend: Given a string that contains only these two characters: `+` and `-`, you and your friend take turns to flip twoconsecutive `"++"` into `"--"`. The game ends when a person can no longer make a move and therefore the other person will be the winner.

Write a function to compute all possible states of the string after one valid move.

For example, given `s = "++++"`, after one move, it may become one of the following states:

```[
"--++",
"+--+",
"++--"
]
```

If there is no valid move, return an empty list `[]`.

```class Solution {
public:
vector<string> generatePossibleNextMoves(string s) {
vector<string> res;
; i < s.size(); ++i) {
] == '+') {
res.push_back(s.substr(, i - ) + ));
}
}
return res;
}
};```

LeetCode All in One 题目讲解汇总(持续更新中...)

## [LeetCode] Flip Game 翻转游戏的更多相关文章

1. [LeetCode] Flip Game 翻转游戏之二

You are playing the following Flip Game with your friend: Given a string that contains only these tw ...

2. [Swift]LeetCode293. 翻转游戏 \$ Flip Game

You are playing the following Flip Game with your friend: Given a string that contains only these tw ...

3. Luogu 1764 翻转游戏 - 枚举 + 搜索

题目描述 kkke在一个n*n的棋盘上进行一个翻转游戏.棋盘的每个格子上都放有一个棋子,每个棋子有2个面,一面是黑色的,另一面是白色的.初始的时候,棋盘上的棋子有的黑色向上,有的白色向上.现在kkke ...

4. [LeetCode] Flip Game II 翻转游戏之二

You are playing the following Flip Game with your friend: Given a string that contains only these tw ...

5. 293. Flip Game只翻转一步的加减号翻转游戏

［抄题］: You are playing the following Flip Game with your friend: Given a string that contains only th ...

6. [LeetCode] Reverse String 翻转字符串

Write a function that takes a string as input and returns the string reversed. Example: Given s = &q ...

7. [LeetCode] Reverse Integer 翻转整数

Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to ...

8. LeetCode Flip Game II

原题链接在这里:https://leetcode.com/problems/flip-game-ii/ 题目: You are playing the following Flip Game with ...

9. LeetCode Flip Game

原题链接在这里:https://leetcode.com/problems/flip-game/ 题目: You are playing the following Flip Game with yo ...

## 随机推荐

1. Sublime Text：Windows下配置C 编译环境和GDB调试环境

写此文解决两个问题: 1.在Sublime Text中实现编译运行含有外部输入的C程序(如含有scanf的程序); 2.在程序运行完毕后不退出cmd,能继续用gdb调试程序. 一.MinGW 下载地址 ...

2. OD19

这个程序关掉之后会出现一个NAG窗口  甚是讨厌   于是我们要想办法干掉他,先查壳  发现没有壳  VC写的 加载进一个工具reshecker试试,发现一个我们要找的对话框, 那我们记住这个位置 1 ...

3. getAttribute与setAttribute用法

getAttribute和setAttribute只能用于元素节点. 1.当用getElementById获得元素节点时 /*---------------------------index.html ...

4. SQL基础语法笔记教程整理

PS:本文适用SQL Server2008语法. 一.关系型数据库和SQL 实际上准确的讲,SQL是一门语言,而不是一个数据库. 什么是SQL呢?简而言之,SQL就是维护和使用关系型数据库中的的数据的 ...

6. HTTP原理

HTTP原理 1 简介 HTTP是一个属于应用层的面向对象的协议,由于其简捷.快速的方式,适用于分布式超媒体信息系统. HTTP协议的主要特点可概括如下: 1.支持客户/服务器模式. 2.简单快速:客 ...

7. linux 磁盘管理学习笔记

磁盘管理命令:fdisk df du fdisk #查看硬盘分区表 df #查看分区使用情况 du #查看文件占用空间情况lvdisplay #逻辑分区 [1] 李洋.df.du.fdisk:Linu ...

8. 课程作业02（关于Java的几点讨论）

---恢复内容开始--- 1.一个Java类文件中真的只能有一个公有类吗? public class Test { public static void main(String[] args) { } ...

9. Python--Pycharm backup_ver1.py 控制台一直Backup FAILED

1.windows不自带zip,需自行安装,http://gnuwin32.sourceforge.net/packages/zip.htm 2.安装后,要配置环境变量:PATH 3.简明Python ...

10. Codeforces #448 Div2 E

#448 Div2 E 题意 给出一个数组,有两种类型操作: 选定不相交的两个区间,分别随机挑选一个数,交换位置. 查询区间和的期望. 分析 线段树区间更新区间求和. 既然是涉及到两个区间,那么对于第 ...