• go实现剑指offer


    https://www.nowcoder.com/exam/oj/ta?page=1&tpId=13&type=13

    0830

    JZ3 数组中重复的数字

    思路一

    将数字放到字典中,多了就加1,如果遇到大于1个数地,直接返回
    https://leetcode.cn/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof/

    func duplicate(numbers []int) int {
    	// write code here
    
    	if numbers == nil {
    		return -1
    	}
    	dict := make(map[int]int)
    
    	for _, value := range numbers {
    		count := 1
    		if _, exist := dict[value]; exist {
    			dict[value]++
    			if dict[value] > 1 {
    				return value
    			}
    		} else {
    			dict[value] = count
    		}
    	}
    	return -1
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    JZ4 二维数组中的查找

    https://leetcode.cn/problems/er-wei-shu-zu-zhong-de-cha-zhao-lcof/

    func findNumberIn2DArray(matrix [][]int, target int) bool {
    	i, j := len(matrix)-1, 0
    	for i >= 0 && j < len(matrix[0]) {
    		if matrix[i][j] > target {
    			i -= 1
    		} else if matrix[i][j] < target {
    			j += 1
    		} else {
    			return true
    		}
    	}
    	return false
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    JZ42 连续子数组的最大和

    https://leetcode.cn/problems/lian-xu-zi-shu-zu-de-zui-da-he-lcof/

    0831

    https://leetcode.cn/problems/shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-lcof/
    https://www.nowcoder.com/practice/11662ff51a714bbd8de809a89c481e21?tpId=13&tqId=2282583&ru=/exam/oj/ta&qru=/ta/coding-interviews/question-ranking&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D1%26tpId%3D13%26type%3D13
    https://leetcode.cn/problems/zui-xiao-de-kge-shu-lcof/

    0901

    https://leetcode.cn/problems/jian-sheng-zi-lcof/
    https://leetcode.cn/problems/li-wu-de-zui-da-jie-zhi-lcof/
    https://leetcode.cn/problems/gu-piao-de-zui-da-li-run-lcof/

    0902

    https://leetcode.cn/problems/ba-shu-zi-fan-yi-cheng-zi-fu-chuan-lcof/
    https://leetcode.cn/problems/chou-shu-lcof/
    https://leetcode.cn/problems/nge-tou-zi-de-dian-shu-lcof/

  • 相关阅读:
    链动2+1模式 一秒教您扩充你自己的私域流量池
    9.1 运用API创建多线程
    MG动画完成练习
    lua调用C++函数
    HTML+CSS期末网页设计前端作品(大三)
    基于Java+SpringBoot+Vue前后端分离毕业设计系统设计和实现
    使用proxy把后端返回的图片域名替换成目标域名
    5. 最长回文子串
    Java文件——File对象
    数据分享|PYTHON用决策树分类预测糖尿病和可视化实例
  • 原文地址:https://blog.csdn.net/ycfxxr/article/details/126613677