Arrays Interview Questions

Last Updated on Friday, 20 July 2007 02:38 Written by EditorFriday, 20 July 2007 02:38

  • You are given an array with integers between 1 and 1,000,000. One integer is in the array twice. How can you determine which one? Can you think of a way to do it using little extra memory.
  • You are given an array with integers between 1 and 1,000,000. One integer is missing. How can you determine which one? Can you think of a way to do it while iterating through the array only once. Is overflow a problem in the solution? Why not?
  • Returns the largest sum of contiguous integers in the array
    Example: if the input is (-10, 2, 3, -2, 0, 5, -15), the largest sum is 8
    int GetLargestContiguousSum(int* anData, int len)
  • Implement Shuffle given an array containing a deck of cards and the number of cards. Now make it O(n).
  • Return the sum two largest integers in an array
    int SumTwoLargest(int* anData, int size)
  • Sum n largest integers in an array of integers where every integer is between 0 and 9
    int SumNLargest(int* anData, int size, int n)

Post to Twitter


Submit Interview Questions at intr[at]freshershome.com



9 Comments

  1. Rishi   |  Wednesday, 25 June 2008 at 1:42 pm

    Can i get answers to above questions.
    Thank you

  2. puja   |  Tuesday, 08 July 2008 at 8:25 pm

    Great questions. Can I get the answers for the above questions.

    thank you

  3. commentinkm   |  Thursday, 12 February 2009 at 2:10 am

    i want to get the answer for the aboveouestion

  4. Aswin   |  Friday, 20 November 2009 at 4:59 am

    Excellent ! Can u please provide the answer for the above questions…. Thank you

  5. manju   |  Monday, 30 November 2009 at 3:33 am

    can i get answers to above questions

  6. madhuri ranadive   |  Monday, 22 February 2010 at 6:52 am

    can a get answers to above questions please

  7. chanchal   |  Sunday, 29 August 2010 at 11:14 am

    cn i get the answers 4 dese questions……

  8. Bhagyashree   |  Friday, 11 February 2011 at 12:30 pm

    can u provide me the answer for the above question please

  9. credit rating   |  Thursday, 09 February 2012 at 9:10 pm

    Excellent . Zer eta definitly nire eskerrak eman nahi duzu duzu merezi!

Leave a Reply