Created
June 22, 2019 10:36
-
-
Save PurwantoGZ/ddfd0fd4d98108266a46c15c909af080 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Rextester.Program.Main is the entry point for your code. Don't change it. | |
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
namespace Rextester | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
//Your code goes here | |
string[] column=new string[2]; | |
List<string> columns=new List<string>(); | |
columns.Add("QCC"); | |
columns.Add("QCC"); | |
columns.Add("QCC"); | |
columns.Add("SS"); | |
columns.Add("SS"); | |
columns.Add("SS"); | |
columns.Add("NSS"); | |
columns.Add("NSS"); | |
int start_merge=1; | |
int end_merge=0; | |
column[0]=columns[0]; | |
for(int i=0;i<columns.Count;i++){ | |
column[1]=columns[i]; | |
if(column[0]==column[1]){ | |
end_merge++; | |
}else{ | |
column[0]=column[1]; | |
Console.WriteLine("{2} - > {0} - {1}",start_merge,end_merge,columns[i-1]); | |
if(i!=0){ | |
start_merge=end_merge+1; | |
} | |
end_merge=start_merge; | |
} | |
} | |
Console.WriteLine("{2} - > {0} - {1}",start_merge,end_merge,column[0]); | |
//Console.WriteLine("Hello, world! {0}",end_merge); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment