Merge pull request #60 from halfrost/code_quality_improvement

optimization code quality level from A to A+
This commit is contained in:
halfrost
2020-08-27 01:07:57 +08:00
committed by YDZ
543 changed files with 2449 additions and 2396 deletions

View File

@ -1,8 +1,8 @@
package leetcode
func characterReplacement(s string, k int) int {
res, left, right, counter, freq := 0, 0, 1, 0, make([]int, 26)
for right = 0; right < len(s); right++ {
res, left, counter, freq := 0, 0, 0, make([]int, 26)
for right := 0; right < len(s); right++ {
freq[s[right]-'A']++
counter = max(counter, freq[s[right]-'A'])
for right-left+1-counter > k {

View File

@ -27,27 +27,27 @@ func Test_Problem424(t *testing.T) {
qs := []question424{
question424{
{
para424{"AABABBA", 1},
ans424{4},
},
question424{
{
para424{"ABBB", 2},
ans424{4},
},
question424{
{
para424{"BAAA", 0},
ans424{3},
},
question424{
{
para424{"ABCDE", 1},
ans424{2},
},
question424{
{
para424{"BAAAB", 2},
ans424{5},
},