aldojm
BAN USERIn C#
Runtime N-K = O(N)
static void Main(string[] args)
{
int k = 3;
List<int> lista = new List<int>(){1,2,3,5,6,8,9,11,12,13};
DifbyK(lista,k);
Console.ReadLine();
}
static void DifbyK(List<int> lista, int k)
{
for (int i =0; i<= lista.Count - k; i++)
{
int index=lista.IndexOf(lista[i]+k);
if ( index>= 0)
{
Console.WriteLine(lista[i] + " & " + lista[index]);
}
}
}
Repjasonmcarrier, Analyst at Abs india pvt. ltd.
Hello, I live in Houston and I am working as a Convention planner in Roberd's company, I also part ...
Repjohndbutler0, Aghori Mahakal Tantrik at BMO Harris Bank
I consider myself to be driven, proactive, hard working, a team player, creative and absolutely passionate person! I am strong ...
Repethelynfrose, Computer Scientist at 247quickbookshelp
Hello, I am Ethelyn and I live in Lake Worth, USA. I am working as a Dog Trainer and Dog ...
In C#
- aldojm April 08, 2016