LINQ : Вопрос 1 : 20

Верный алгоритм поиска первого уникального символа в строке?

static void Main() 
{ 
    Console.WriteLine(FindFirstUniq("SomeString")); 
} 
 
// 1 
private static char FindFirstUniq(string str) 
{ 
    Dictionary result = str.GroupBy(x => x).ToDictionary(x => x.Key, v => 0); 
    foreach (char t in str) 
    { 
       result[t] += 1; 
    } 
    return result.FirstOrDefault(x => x.Value == 1).Key; 
} 
 
// 2 
private static char FindFirstUniq(string str) 
{ 
    Dictionary result = str.ToDictionary(x => x, v => 0); 
    foreach (char t in str) 
    { 
       result[t] += 1; 
    } 
    return result.FirstOrDefault(x => x.Value == 1).Key; 
} 
 
// 3 
private static char FindFirstUniq(string str) 
{ 
    Dictionary result = str.GroupBy(x => x).ToDictionary(x => x.Key, v => 0); 
    foreach (char t in str) 
    { 
       result[t] += 1; 
    } 
    return result.FirstOrDefault(x => x.Value == 0).Key; 
} 
1 балл


© Copyright © 2017 - 2019 Все права защищены. Бесплатное онлайн образование.
  • https://disdik.munabarat.go.id/nusantara/slot/
  • https://dispendik.sidoarjokab.go.id/nuansa/gacor/
  • https://dkpd.grobogan.go.id/jakarta/gacor/
  • https://sbobet88.blog.unsia.ac.id
  • https://pafinusantara.blog.unsia.ac.id/bet88
  • https://idn-poker.blog.unsia.ac.id
  • https://slot777-gacor.blog.unsia.ac.id
  • https://agen-188bet.blog.unsia.ac.id
  • https://situs-slot.blog.unsia.ac.id
  • https://bet88-slot.blog.unsia.ac.id
  • https://2021.kinerja.ekon.go.id/up/slot777
  • https://2021.kinerja.ekon.go.id/halal/bet88
  • https://program-gacor.blog.unsia.ac.id
  • surapati.ac.id
  • untagsby.ac.id
  • kingandiboston.com
  • janeashton.com
  • redbrickcafechester.com
  • villanosdeljazz.com
  • slot