Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfefe215

Browse files
author
applewjg
committed
add recursion solution
Change-Id: I4c99fbc284777b3be13eeee16feecc39dd5f6aa8
1 parenta0d592a commitfefe215

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎FactorialTrailingZeroes.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
Solution: ...
1313
*/
1414
publicclassSolution {
15-
publicinttrailingZeroes(intn) {
15+
publicinttrailingZeroes_1(intn) {
1616
intres =0;
1717
while (n !=0) {
1818
res +=n /5;
1919
n =n /5;
2020
}
2121
returnres;
2222
}
23+
publicinttrailingZeroes_2(intn) {
24+
if (n ==0)return0;
25+
returnn /5 +trailingZeroes_2(n /5);
26+
}
2327
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp