tag:blogger.com,1999:blog-4731036105252322780.post7596950864676809648..comments2024-03-01T02:55:58.951-08:00Comments on Buttercola: Leetcode: Single Number II Butter is looking for a jobhttp://www.blogger.com/profile/01481083468821703855noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-4731036105252322780.post-6492468530850946342015-08-31T04:38:26.170-07:002015-08-31T04:38:26.170-07:00Here is another solution
public class Solution { ...Here is another solution<br />public class Solution { <br /> public int singleNumber(int[] nums) { <br /> int p = 0; <br /> int q = 0; <br /> for(int i = 0; i<nums.length; i++){ <br /> p = q & (p ^ nums[i]); <br /> q = p | (q ^ nums[i]); <br /> } <br /> return q; <br /> } <br />} <br />Analysis from this blog post : http://traceformula.blogspot.com/2015/08/single-number-ii-how-to-come-up-with.html traceformulahttps://www.blogger.com/profile/07593856187162437549noreply@blogger.com