首页 > 代码库 > LeetCode----172. Factorial Trailing Zeroes(Java)
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 stub14 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)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。