摘要: func threeSum(nums []int) [][]int { // 从小到大排序,如果大于0就不用找了 sort.Ints(nums) res := [][]int{} for i:=0; i<len(nums)-2; i++ { // 结束查找 if nums[i] > 0 { brea 阅读全文
posted @ 2024-06-14 11:05 gdut17_2 阅读(15) 评论(0) 推荐(0)
摘要: func maxArea(height []int) int { res := 0 i := 0 j := len(height)-1 for i<j { dif := j-i if height[i]<height[j] { res = max(res, dif * height[i]) i++ 阅读全文
posted @ 2024-06-14 09:58 gdut17_2 阅读(19) 评论(0) 推荐(0)