Thread: Good interview Questions

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    4

    Good interview Questions

    Having array[99] and i am trying to assigning the 1 to 100 numerical values in the array in any manner and no duplicate values in the array there will be one missing number . Find the missing number .

    Give the solution in C or C++

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Code:
    DWORD MissingNumber = 5050;
    
    for(int x = 0;x<99;x++) MissingNumber -= array[x];
    Missing number will now contain the missing number.

  3. #3
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    Quote Originally Posted by abachler View Post
    Code:
    DWORD MissingNumber = 5050;
    
    for(int x = 0;x<99;x++) MissingNumber -= array[x];
    Missing number will now contain the missing number.
    That's an awesome solution. Wouldn't have come up with that myself.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Good interview Questions
    By rupendranaidu in forum C Programming
    Replies: 2
    Last Post: 08-21-2009, 06:43 AM
  2. Good Programming schools are they out there???
    By jbarby in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 05-12-2009, 06:31 PM
  3. Any good tutorials?
    By kimmag in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2008, 07:44 AM
  4. What are some good books on C?
    By php111 in forum C Programming
    Replies: 9
    Last Post: 10-01-2008, 06:16 AM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM