Update 数组相关.md

master
Omooo 5 years ago
parent c2448ff0bd
commit e5d5f4ef33
  1. 15
      blogs/Algorithm/剑指 Offer/数组相关.md

@ -2,6 +2,21 @@
数组相关
---
[03. 数组中重复的数字](https://leetcode-cn.com/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof/)
```java
class Solution {
public int findRepeatNumber(int[] nums) {
int[] res = new int[nums.length];
for (int i : nums) {
res[i]++;
if (res[i] > 1) return i;
}
return -1;
}
}
```
[04. 二维数组中的查找](https://leetcode-cn.com/problems/er-wei-shu-zu-zhong-de-cha-zhao-lcof/)
```java

Loading…
Cancel
Save