package com.lintcode; /** * 2. å°¾é¨çé¶ * 设计ä¸ä¸ªç®æ³ï¼è®¡ç®åºné¶ä¹ä¸å°¾é¨é¶çä¸ªæ° * * æ ·ä¾ 11! = 39916800ï¼å æ¤åºè¯¥è¿å 2 * * O(logN)çæ¶é´å¤æåº¦ */ public class Solution2 { /* * @param n: An integer * @return: An integer, denote the number of trailing zeros in n! */ public long trailingZeros(long n) { // write your code here, try to do it without arithmetic operators. long count = 0; while (n > 0){ count += n / 5; n /= 5; } return count; } }