码迷,mamicode.com
首页 > 编程语言 > 详细

LeetCode----172. Factorial Trailing Zeroes(Java)

时间:2016-09-13 22:12:50      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:

 1 package singlenumber136;
 2 //Given an array of integers, every element appears twice except for one. Find that single one.
 3 //Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
 4 public class Solution {
 5      public static int singleNumber(int[] nums) {
 6         int result=0;
 7         for(int i=0;i<nums.length;i++)
 8             result^=nums[i];
 9         return result;
10     }
11 
12     public static void main(String[] args) {
13         // TODO Auto-generated method stub
14         int[] nums={1,1,2,3,2,4,5,4,5};
15         System.out.println(singleNumber(nums));
16 
17     }
18 
19 }

 

LeetCode----172. Factorial Trailing Zeroes(Java)

标签:

原文地址:http://www.cnblogs.com/luluqiao/p/5869867.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!