https://www.nowcoder.com/exam/oj/ta?page=1&tpId=13&type=13
将数字放到字典中,多了就加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
}
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
}
https://leetcode.cn/problems/lian-xu-zi-shu-zu-de-zui-da-he-lcof/
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/
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/
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/