Up goreport score

This commit is contained in:
halfrost
2022-09-09 20:20:20 +08:00
parent e227edf55a
commit dff1d84e1e
4 changed files with 8 additions and 8 deletions

View File

@ -32,7 +32,7 @@ func splitIntoFibonacci(S string) []int {
return res
}
//Propagate for rest of the string
// Propagate for rest of the string
func findRecursiveCheck(S string, x1 int, x2 int, left int, res *[]int, isComplete *bool) {
if x1 >= 1<<31 || x2 >= 1<<31 { // 题目要求每个数都要小于 2^31 - 1 = 2147483647此处剪枝很关键
return

View File

@ -1,10 +1,10 @@
package leetcode
/*
匹配跟单词中的字母顺序,字母个数都无关,可以用 bitmap 压缩
1. 记录 word 中 利用 map 记录各种 bit 标示的个数
2. puzzles 中各个字母都不相同! 记录 bitmap然后搜索子空间中各种 bit 标识的个数的和
因为 puzzles 长度最长是7所以搜索空间 2^7
匹配跟单词中的字母顺序,字母个数都无关,可以用 bitmap 压缩
1. 记录 word 中 利用 map 记录各种 bit 标示的个数
2. puzzles 中各个字母都不相同! 记录 bitmap然后搜索子空间中各种 bit 标识的个数的和
因为 puzzles 长度最长是7所以搜索空间 2^7
*/
func findNumOfValidWords(words []string, puzzles []string) []int {
wordBitStatusMap, res := make(map[uint32]int, 0), []int{}
@ -29,7 +29,7 @@ func toBitMap(word []byte) uint32 {
return res
}
//利用 dfs 搜索 puzzles 的子空间
// 利用 dfs 搜索 puzzles 的子空间
func findNum(puzzles []byte, bitMap uint32, totalNum *int, m map[uint32]int) {
if len(puzzles) == 0 {
*totalNum = *totalNum + m[bitMap]

View File

@ -1,6 +1,6 @@
package leetcode
//解法一 优化版 prefixSum + sufixSum
// 解法一 优化版 prefixSum + sufixSum
func getSumAbsoluteDifferences(nums []int) []int {
size := len(nums)
sufixSum := make([]int, size)

View File

@ -2,7 +2,7 @@ package leetcode
func countGoodRectangles(rectangles [][]int) int {
minLength, count := 0, 0
for i, _ := range rectangles {
for i := range rectangles {
minSide := 0
if rectangles[i][0] <= rectangles[i][1] {
minSide = rectangles[i][0]