mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2026-03-13 10:02:05 +08:00
Update Time_Complexity.md
Modify isPrime function
This commit is contained in:
@@ -44,6 +44,7 @@ void hello (int n){
|
|||||||
|
|
||||||
```c
|
```c
|
||||||
bool isPrime (int n){
|
bool isPrime (int n){
|
||||||
|
if (num <= 1) return false;
|
||||||
for( int x = 2 ; x * x <= n ; x ++ )
|
for( int x = 2 ; x * x <= n ; x ++ )
|
||||||
if( n % x == 0 )
|
if( n % x == 0 )
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user