Arrays Interview Questions

  • 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)

Share this post:

Recent Posts

9 Comments

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

  2. Bhagyashree says:

    can u provide me the answer for the above question please

  3. chanchal says:

    cn i get the answers 4 dese questions……

  4. madhuri ranadive says:

    can a get answers to above questions please

  5. manju says:

    can i get answers to above questions

  6. Aswin says:

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

  7. commentinkm says:

    i want to get the answer for the aboveouestion

  8. puja says:

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

    thank you

  9. Rishi says:

    Can i get answers to above questions.
    Thank you

Leave a Comment