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


 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 }

优质内容筛选与推荐>>
1、专业课的复习与考试
2、數學習作
3、[转载]C# 一些小问题收集
4、CPP-网络/通信:WebService
5、document


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号