Skip to content

Commit 77452bc

Browse files
enable MemberName check
1 parent 1590ef5 commit 77452bc

File tree

14 files changed

+52
-52
lines changed

14 files changed

+52
-52
lines changed

fishercoder_checkstyle.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@
112112
<!--<message key="name.invalidPattern"-->
113113
<!--value="Type name ''{0}'' must match pattern ''{1}''."/>-->
114114
<!--</module>-->
115-
<!--<module name="MemberName">-->
116-
<!--<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>-->
117-
<!--<message key="name.invalidPattern"-->
118-
<!--value="Member name ''{0}'' must match pattern ''{1}''."/>-->
119-
<!--</module>-->
115+
<module name="MemberName">
116+
<property name="format" value="^[a-z]*[a-z0-9][a-zA-Z0-9]*$"/>
117+
<message key="name.invalidPattern"
118+
value="Member name ''{0}'' must match pattern ''{1}''."/>
119+
</module>
120120
<module name="ParameterName">
121121
<property name="format" value="^[a-zA-Z][a-zA-Z0-9]*$"/>
122122
<message key="name.invalidPattern"

src/main/java/com/fishercoder/solutions/_12.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
public class _12 {
88
//looked at this post: https://discuss.leetcode.com/topic/12384/simple-solution
99
public String intToRoman(int num) {
10-
String M[] = new String[]{"", "M", "MM", "MMM"};
10+
String M[] = new String[]{"", "m", "MM", "MMM"};
1111
String C[] = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"};
1212
String X[] = {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"};
1313
String I[] = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"};

src/main/java/com/fishercoder/solutions/_174.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/**174. Dungeon Game
66
7-
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially positioned in the top-left room and must fight his way through the dungeon to rescue the princess.
7+
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of m x N rooms laid out in a 2D grid. Our valiant knight (K) was initially positioned in the top-left room and must fight his way through the dungeon to rescue the princess.
88
99
The knight has an initial health point represented by a positive integer. If at any point his health point drops to 0 or below, he dies immediately.
1010

src/main/java/com/fishercoder/solutions/_466.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
On the other hand, we define that string s1 can be obtained from string s2 if we can remove some characters from s2 such that it becomes s1.
99
For example, “abc” can be obtained from “abdbec” based on our definition, but it can not be obtained from “acbbe”.
1010
You are given two non-empty strings s1 and s2 (each at most 100 characters long) and two integers 0 ≤ n1 ≤ 106 and 1 ≤ n2 ≤ 106.
11-
Now consider the strings S1 and S2, where S1=[s1,n1] and S2=[s2,n2]. Find the maximum integer M such that [S2,M] can be obtained from S1.
11+
Now consider the strings S1 and S2, where S1=[s1,n1] and S2=[s2,n2]. Find the maximum integer m such that [S2,m] can be obtained from S1.
1212
1313
Example:
1414

src/main/java/com/fishercoder/solutions/_482.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.fishercoder.solutions;
22

33
/**
4-
* Now you are given a string S, which represents a software license key which we would like to format. The string S is composed of alphanumerical characters and dashes. The dashes split the alphanumerical characters within the string into groups. (i.e. if there are M dashes, the string is split into M+1 groups). The dashes in the given string are possibly misplaced.
4+
* Now you are given a string S, which represents a software license key which we would like to format. The string S is composed of alphanumerical characters and dashes. The dashes split the alphanumerical characters within the string into groups. (i.e. if there are m dashes, the string is split into m+1 groups). The dashes in the given string are possibly misplaced.
55
66
We want each group of characters to be of length K (except for possibly the first group, which could be shorter, but still must contain at least one character). To satisfy this requirement, we will reinsert dashes. Additionally, all the lower case letters in the string must be converted to upper case.
77

src/main/java/com/fishercoder/solutions/_488.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ public class _488 {
4141
/**credit: https://discuss.leetcode.com/topic/79820/short-java-solution-beats-98
4242
* Two layer of recursion, pretty cool!*/
4343

44-
int MAXCOUNT = 6; // the max balls you need will not exceed 6 since "The number of balls in your hand won't exceed 5"
44+
int maxcount = 6; // the max balls you need will not exceed 6 since "The number of balls in your hand won't exceed 5"
4545

4646
public int findMinStep(String board, String hand) {
4747
int[] handCount = new int[26];
4848
for (int i = 0; i < hand.length(); ++i) {
4949
++handCount[hand.charAt(i) - 'A'];
5050
}
5151
int result = dfs(board + "#", handCount); // append a "#" to avoid special process while j==board.length, make the code shorter.
52-
return result == MAXCOUNT ? -1 : result;
52+
return result == maxcount ? -1 : result;
5353
}
5454
private int dfs(String s, int[] handCount) {
5555
s = removeConsecutive(s);
5656
if (s.equals("#")) return 0;
57-
int result = MAXCOUNT;
57+
int result = maxcount;
5858
int need = 0;
5959
for (int i = 0, j = 0 ; j < s.length(); ++j) {
6060
if (s.charAt(j) == s.charAt(i)) continue;

src/main/java/com/fishercoder/solutions/_498.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* 498. Diagonal Traverse
55
*
6-
* Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order
6+
* Given a matrix of m x N elements (m rows, N columns), return all elements of the matrix in diagonal order
77
* as shown in the below image.
88
99
Example:

src/main/java/com/fishercoder/solutions/_529.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
/**
77
* Let's play the minesweeper game (Wikipedia, online game)!
88
9-
You are given a 2D char matrix representing the game board. 'M' represents an unrevealed mine, 'E' represents an unrevealed empty square, 'B' represents a revealed blank square that has no adjacent (above, below, left, right, and all 4 diagonals) mines, digit ('1' to '8') represents how many mines are adjacent to this revealed square, and finally 'X' represents a revealed mine.
9+
You are given a 2D char matrix representing the game board. 'm' represents an unrevealed mine, 'E' represents an unrevealed empty square, 'B' represents a revealed blank square that has no adjacent (above, below, left, right, and all 4 diagonals) mines, digit ('1' to '8') represents how many mines are adjacent to this revealed square, and finally 'X' represents a revealed mine.
1010
11-
Now given the next click position (row and column indices) among all the unrevealed squares ('M' or 'E'), return the board after revealing this position according to the following rules:
11+
Now given the next click position (row and column indices) among all the unrevealed squares ('m' or 'E'), return the board after revealing this position according to the following rules:
1212
13-
If a mine ('M') is revealed, then the game is over - change it to 'X'.
13+
If a mine ('m') is revealed, then the game is over - change it to 'X'.
1414
If an empty square ('E') with no adjacent mines is revealed, then change it to revealed blank ('B') and all of its adjacent unrevealed squares should be revealed recursively.
1515
If an empty square ('E') with at least one adjacent mine is revealed, then change it to a digit ('1' to '8') representing the number of adjacent mines.
1616
Return the board when no more squares will be revealed.
1717
Example 1:
1818
Input:
1919
2020
[['E', 'E', 'E', 'E', 'E'],
21-
['E', 'E', 'M', 'E', 'E'],
21+
['E', 'E', 'm', 'E', 'E'],
2222
['E', 'E', 'E', 'E', 'E'],
2323
['E', 'E', 'E', 'E', 'E']]
2424
@@ -27,7 +27,7 @@ If an empty square ('E') with at least one adjacent mine is revealed, then chang
2727
Output:
2828
2929
[['B', '1', 'E', '1', 'B'],
30-
['B', '1', 'M', '1', 'B'],
30+
['B', '1', 'm', '1', 'B'],
3131
['B', '1', '1', '1', 'B'],
3232
['B', 'B', 'B', 'B', 'B']]
3333
@@ -37,7 +37,7 @@ If an empty square ('E') with at least one adjacent mine is revealed, then chang
3737
Input:
3838
3939
[['B', '1', 'E', '1', 'B'],
40-
['B', '1', 'M', '1', 'B'],
40+
['B', '1', 'm', '1', 'B'],
4141
['B', '1', '1', '1', 'B'],
4242
['B', 'B', 'B', 'B', 'B']]
4343
@@ -54,7 +54,7 @@ If an empty square ('E') with at least one adjacent mine is revealed, then chang
5454
5555
Note:
5656
The range of the input matrix's height and width is [1,50].
57-
The click position will only be an unrevealed square ('M' or 'E'), which also means the input board contains at least one clickable square.
57+
The click position will only be an unrevealed square ('m' or 'E'), which also means the input board contains at least one clickable square.
5858
The input board won't be a stage when game is over (some mines have been revealed).
5959
For simplicity, not mentioned rules should be ignored in this problem. For example, you don't need to reveal all the unrevealed mines when the game is over, consider any cases that you will win the game or flag any squares.
6060
*/

src/main/java/com/fishercoder/solutions/_547.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* For example, if A is a direct friend of B, and B is a direct friend of C, then A is an indirect friend of C.
99
* And we defined a friend circle is a group of students who are direct or indirect friends.
1010
11-
Given a N*N matrix M representing the friend relationship between students in the class.
12-
If M[i][j] = 1, then the ith and jth students are direct friends with each other, otherwise not.
11+
Given a N*N matrix m representing the friend relationship between students in the class.
12+
If m[i][j] = 1, then the ith and jth students are direct friends with each other, otherwise not.
1313
And you have to output the total number of friend circles among all the students.
1414
1515
Example 1:
@@ -32,8 +32,8 @@
3232
3333
Note:
3434
N is in range [1,200].
35-
M[i][i] = 1 for all students.
36-
If M[i][j] = 1, then M[j][i] = 1.
35+
m[i][i] = 1 for all students.
36+
If m[i][j] = 1, then m[j][i] = 1.
3737
*/
3838
public class _547 {
3939

src/main/java/com/fishercoder/solutions/_562.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/**Longest Line of Consecutive One in Matrix
88
*
9-
* Given a 01 matrix M, find the longest line of consecutive one in the matrix. The line could be horizontal, vertical, diagonal or anti-diagonal.
9+
* Given a 01 matrix m, find the longest line of consecutive one in the matrix. The line could be horizontal, vertical, diagonal or anti-diagonal.
1010
1111
Example:
1212

0 commit comments

Comments
 (0)