UNPKG
ts-ds-tool
Version:
latest (0.1.5)
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
Data structure and algorithm of TypeScript
github.com/HaifengDu/ts-ds-tool
HaifengDu/ts-ds-tool
ts-ds-tool
/
src
/
algorithms
/
math
/
gcd
/
gcd.ts
7 lines
(6 loc)
•
142 B
text/typescript
View Raw
1
2
3
4
5
6
7
export
function
gcd
(
num1
:
number
,
num2
:
number
):
number
{
if
(num2 ===
0
){
return
num1; }
return
gcd
(num2, num1 % num2); }