Hirdetés
- Viber: ingyen telefonálás a mobilodon
- Hieronymus: Hogyan parkolj hátramenetben profi módon
- Luck Dragon: Óraátállítás
- gban: Ingyen kellene, de tegnapra
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- Geri Bátyó: Agglegénykonyha 14 – Kések, késélezés
- hmzs: Fujitsu Futro S920 csúcsra járatva
- sziku69: Fűzzük össze a szavakat :)
- Luck Dragon: Asszociációs játék. :)
- Gurulunk, WAZE?!
-
LOGOUT

Új hozzászólás Aktív témák
-
Chesterfield
őstag
Erre a feladatra tudtok hatékonyabb algoritmust?
Write a function that, when passed a list and a target sum, returns two distinct zero-based indices of any two of the numbers, whose sum is equal to the target sum. If there are no two numbers, the function should return null.
For example, FindTwoSum(new List<int>() { 3, 1, 5, 7, 5, 9 }, 10) should return a Tuple<int, int> containing any of the following pairs of indices:
0 and 3 (or 3 and 0) as 3 + 7 = 10
1 and 5 (or 5 and 1) as 1 + 9 = 10
2 and 4 (or 4 and 2) as 5 + 5 = 10public static Tuple<int, int> FindTwoSum(IList<int> list, int sum)
{
for (int i = 0; i < list.Count; i++)
{
for (int j = i + 1; j < list.Count; j++)
{
if (list[i] + list[j] == sum)
{
return Tuple.Create(i, j);
}
}
}
return null;
}azt mondja a kiértékelő, hogy Performance testen ez elbukik.
Új hozzászólás Aktív témák
● olvasd el a téma összefoglalót!
- Ubiquiti hálózati eszközök
- Ismeretlen régiókba látogat a Bungie, teszteltük a Marathont
- Tőzsde és gazdaság
- Filmvilág
- OLED monitor topic
- PlayStation 5
- Apple MacBook
- Milyen HASZNÁLT notebookot vegyek?
- Windows 11: miért nem vált mindenki?
- NVIDIA GeForce RTX 5070 / 5070 Ti (GB205 / 203)
- További aktív témák...
- Utolsó! M1 Max MacBook Pro 16"/ 64GB / 2TB / 27%-os ÁFÁS - (0307AB)
- Sosemhasznált! HP OmniBook 5 i3-1315U 8GB 512GB 16" FHD+ Gar.: 1 év
- BESZÁMÍTÁS! Philips 223V5LHSB2/00 22 75Hz FHD TN 5ms monitor garanciával hibátlan működéssel
- Everycom Cubelite Ultra projektor
- ÁRGARANCIA!Épített KomPhone Ryzen 9 5900X 16/32/64GB RAM RTX 5070 12GB GAMER PC termékbeszámítással
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest

