Finding of the 4 larger (bigger) numbers from the list
like{1245,4587,2145,1163,29987,65783.....}



Finding of the 4 larger (bigger) numbers from the list like{1245,4587,2145,1163,29987,65783.....}..

Answer / santhosh

int Max = 4;
List<int> lst = new List<int>(new int[] { 1, 12,
2, 11, 15, 3, 14, 4, 5, 6, 7, 8, 9, 10 });
lst.Sort();
if (Max <= lst.Count)
Console.WriteLine(string.Format("The {0} th
Maximum value is {1}.", Max, lst[lst.Count - Max]));
else
Console.WriteLine(string.Format("This list
contain less items. So you could not find the {0}th highest
value from the list.", Max));

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More OOPS Interview Questions

What is extreme programming?

2 Answers  


The IT giant Tirnop has recently crossed a head count of 150000 and earnings of $7 billion. As one of the forerunners in the technology front, Tirnop continues to lead the way in products and services in India. At Tirnop, all programmers are equal in every respect. They receive identical salaries and also write code at the same rate. Suppose 14 such programmers take 14 minutes to write 14 lines of code in total. How long will in take 5 programmers to write 5 lines of code in total ?

6 Answers   TCS,


What is difference between function overloading and overriding?

1 Answers   emc2,


What is and I oop mean?

1 Answers  


Is oop better than procedural?

1 Answers  


Explain the concept of abstracion and encapsulation with one example. What is the difference between them?

3 Answers   PCS,


What is abstraction in oops?

1 Answers  


how to tackle technical questions

1 Answers  


What is virtual constructors/destructors?

4 Answers   IBS,


What is the difference between the c++ & java?

2 Answers  


What are constructors in oop?

1 Answers  


why function overloading is not called as pure polymorphism?

2 Answers  


Categories