tag:blogger.com,1999:blog-6082652835152798567.post3391791760946026164..comments2024-03-28T21:41:58.974-07:00Comments on Sql server, .net and c# video tutorial: Part 1 - Can you store different types in an array in c#Unknownnoreply@blogger.comBlogger4125tag:blogger.com,1999:blog-6082652835152798567.post-11217419822078929232016-10-24T19:23:29.962-07:002016-10-24T19:23:29.962-07:00//Indexes of output elements
int i1 = ... //Indexes of output elements<br /> int i1 = 0, i2 = 0;<br /> //<br /> int k = 100;<br /> for (int i = 0; i < input.Length - 1; i++ )<br /> {<br /> for (int j = i + 1; j < input.Length; j++)<br /> {<br /> if (Math.Abs( input[i] + input[j]) < k)<br /> {<br /> k = Math.Abs (input[i] + input[j]);<br /> i1 = i;<br /> i2 = j;<br /> } <br /> }<br /> }Andriy Stetskovychhttps://www.blogger.com/profile/02603881807644223137noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-9000414195188033042016-10-20T02:09:10.658-07:002016-10-20T02:09:10.658-07:00int[] intArray = new int[5] { 8, 10, 2, 6, 3 };
Ar...int[] intArray = new int[5] { 8, 10, 2, 6, 3 };<br />Array.Sort(intArray);<br /><br />Using foreach to loop value2rkhttps://www.blogger.com/profile/06746940220581589266noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-19334884033177844252015-12-28T21:40:29.645-08:002015-12-28T21:40:29.645-08:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/16451493712913890338noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-57894331484809468772015-12-28T21:40:01.037-08:002015-12-28T21:40:01.037-08:00Questions faced in an interview: ...Questions faced in an interview: Problem1:<br />You are given any array of length n,containing both +ve & -ve numbers.<br />You need to write a program to find the two elements such that their sum is closest to zero.<br />eg.<br />Input array[15,5,-20,30,-45]<br />Output should be 15,-20 as their sum is 5 which is closest to zero.<br /><br />Problem2:<br />You are given any array of length n.You have to sort the array elements in decreasing order of their frequency.Use of Collections is not allowed.Write a function which sorts the element accordingly.<br />eg.<br />Input :[2,3,4,2,8,1,1,2]<br />Output:[2,2,2,1,1,3,4,8]<br />Can u record a video for it.?Thanks in advance :)Anonymoushttps://www.blogger.com/profile/16451493712913890338noreply@blogger.com