Skip to content

Commit

Permalink
update toc
Browse files Browse the repository at this point in the history
  • Loading branch information
rbmonster committed Oct 23, 2022
1 parent 86b63bd commit f3b38fc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/com/learning/algorithm/ALGORITHM.md
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,28 @@ private static boolean isPowerOfTwo(int n) {
- [寻找数组的中心下标](https://leetcode-cn.com/problems/find-pivot-index/)

### 素数

如何确定一个数是素数
```java

public class Solution {

public static boolean isPrime(int n) {
if (n < 0) {
return false;
}
int k = (int) Math.sqrt(n);
for (int i = 2; i <= k; i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
}
```

### 求余数常见操作

```java
Expand Down

0 comments on commit f3b38fc

Please sign in to comment.