Skip to content

Instantly share code, notes, and snippets.

@cosminpopescu14
Created March 16, 2018 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosminpopescu14/0aa43ae3cc84da3b22c98f1cc27df68b to your computer and use it in GitHub Desktop.
Save cosminpopescu14/0aa43ae3cc84da3b22c98f1cc27df68b to your computer and use it in GitHub Desktop.
My solution (or a trial) to Run Length Encoding (Function Problem)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication11
{
//https://practice.geeksforgeeks.org/problems/run-length-encoding/1#ExpectOP
class Program
{
static void Main(string[] args)
{
string input = "relax Don't do it";
var freq = from x in input
group x by x into y
select y;
foreach (var item in freq)
{
Console.WriteLine(string.Join("--", item.First(), item.Count()));
//Console.WriteLine(item.First().ToString() + item.Count().ToString());
}
Console.ReadLine();
}
}
}
@cosminpopescu14
Copy link
Author

My attempt at least !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment