English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How will we find the number that occurs just once

2007-01-21 22:33:48 · 2 answers · asked by Shashank 2 in Science & Mathematics Mathematics

2 answers

You didn't specify if there are any extra rules....

If I were doing it myself, or I were writing a computer program, I would do it like this.

I would first get a separate piece of paper (or, for a computer program, some kind of "list" data structure).

For each number in the list,
  1) Look to see if it's already written down on the other piece of paper (or stored in the "list").
    a) If it is, cross it off (or delete it from the "list").
    b) If it isn't, write it on the paper (add it to the "list"). (It's best to keep the numbers in order on the paper or in the list, so that it's easy to find them to cross them off.)
  2) Go to the next number.

When you're finished, the only number that isn't crossed off (or the only number in the "list") will be the one that isn't repeated.

2007-01-23 08:27:02 · answer #1 · answered by Jim Burnell 6 · 0 0

Put some marks near the numbers which repeats exactly twice.

After completing the marks one number will be left out with out any mark. That is the number which occurs only ones.

2007-01-22 07:17:38 · answer #2 · answered by Pearlsawme 7 · 0 0

fedest.com, questions and answers