作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题思路 代码 日期 题目地址:https://leetcode.com/problems/regions-cut-by-slashes/description/ 题目描述 In a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a /, \, or blank spac…
在由 1 x 1 方格组成的 N x N 网格 grid 中,每个 1 x 1 方块由 /.\ 或空格构成.这些字符会将方块划分为一些共边的区域. (请注意,反斜杠字符是转义的,因此 \ 用 "\\" 表示.). 返回区域的数目. 示例 1: 输入: [   " /",   "/ " ] 输出:2 解释:2x2 网格如下: 示例 2: 输入: [   " /",   " " ] 输出:1 解释:2x2 网格…
原题链接在这里:https://leetcode.com/problems/regions-cut-by-slashes/ 题目: In a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a /, \, or blank space.  These characters divide the square into contiguous regions. (Note that backslash chara…
In a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a /, \, or blank space.  These characters divide the square into contiguous regions. (Note that backslash characters are escaped, so a \ is represented as "\\".) Return the…
题目如下: In a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a /, \, or blank space.  These characters divide the square into contiguous regions. (Note that backslash characters are escaped, so a \ is represented as "\\".) Retu…
In a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a /, \, or blank space.  These characters divide the square into contiguous regions. (Note that backslash characters are escaped, so a \ is represented as "\\".) Return the…
两个不起眼但是比较重要的设定 Python str类型的字面量解释器 当反斜杠及其紧接字符无法构成一个具有特殊含义的序列('recognized escape sequences')时,Python选择保留全部字符.直接看例子: >>> '\c' '\\c' >>> '\d' '\\d' 官方管'\c'这种序列叫'unrecognized escape sequences'.官方文档相应部分: Unlike Standard C, all unrecognized es…
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. For example, X X X X X O O X X X O X X O X X After running your function, the board should…
今天客户那边遇到了一个比较奇葩的问题跑来问我,这个问题比较冷门,所以特别记录下. 问题描述 数据库的字段存在斜杠或者空格的时候,怎么用sql进行insert或者select操作. 问题解答 对于这种特殊字符,我们一般想到的是用转义符进行处理,所以试了下"/".引号.单引号等常见的转义符,发现依然语法错误,又查了下mysql的官方说明: 特殊字符位于列名中时必须进行转义,如果列名中包含\t,(,),/,\,=,<,>,+,-,*,^,",',[,],~,#,|,&a…
有时候我们需要匹配反斜杠,你可能会把对应的正则表达式写成 "\\" 然后可能会有如下输出: Exception in thread "main" java.util.regex.PatternSyntaxException: Unexpected internal error near index 1 \ ^ ..... 可能这个问题对于初学者来说比较头疼,但是只要别人一点可能就明白了. JAVA中匹配反斜杠的正则表达式的书写方式为: String regex=&q…