link mingle home | logged in as: guest | login/register| submit link


IndiaDiscuss.com : Social Bookmarkings and News Networking Site for India
interview_questions
Bookmarks
2n+1 Duplicated element
8
Votes

Given an array A which consists of numbers which are all duplicated 2n times except one which is duplicated 2n+1 times.Write a function to find the number which is duplicated 2n+1 times

saved under Amazon Interview Questions by interview_questions

 
     public int OddNumbered(int[] input){
     int ret = 0;
     for (int i = 0; i < input.length; i++)ret^=input[i];
     return ret;
    }

comment by freebooksandarticles on 2008-06-12 22:22:51
 



Enter the string above
 
IndiaDiscuss | Published News | Hot
Indian Social News and Links Network
IndiaDiscuss | Published News
Indian Social News and Links Network