Finding the non-repeating character in given string
Back to: Coding Interview Questions
Finding the non-repeating charcter in given string in c#.
using System; using System.Collections.Generic; using System.Linq; public class Program { public static void Main() { string temp=""; string input="Google"; input=input.ToLower(); foreach( var c in input) { var result=input.Where(s=>s.Equals(c)).ToList(); if(result.Count==1) { temp=temp+c; } } Console.WriteLine(temp); } }
Output
le