Question d’entretien chez Pegasystems

How do you check whether String contains any duplicate characters?

Réponses aux questions d'entretien

Utilisateur anonyme

10 mai 2015

I answered him by saying Get a byte array and Get each character of String, Convert it to ASCII number and mark the position of byte array as that of ASCII number

2

Utilisateur anonyme

1 juil. 2018

var inputValue = "aabcdefgghi" ; var result = OnlyOnceCheck(inputValue); Console.WriteLine(result.ToString()); public static bool OnlyOnceCheck(string input) { return input.GroupBy(x => x).Any(g => g.Count() > 1); }