We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;
class Solution {
static int StrokesToPaint(int N,string[] C)
{
//C = new string[N];
int count=1;
for(int i=0; i<=(N-1); i++)
{
if(i!=4)
{
if(C[i] != C[i+1])
{
count = count+1;
}
}
}
return count;
}
static void Main(string[] args) {
TextWriter textWriter = new StreamWriter(@System.Environment.GetEnvironmentVariable("OUTPUT_PATH"), true);
int N = Convert.ToInt32(Console.ReadLine());
//string[] C = new string[N];
string[] C = Array.ConvertAll(Console.ReadLine().Split(' '), aTemp =>
Convert.ToString(aTemp));
//string C = Console.ReadLine();
int count=StrokesToPaint(N,C);
//Console.WriteLine(count);
textWriter.WriteLine(count);
textWriter.Flush();
textWriter.Close();
}
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Paint The Tiles
You are viewing a single comment's thread. Return to all comments →
using System.CodeDom.Compiler; using System.Collections.Generic; using System.Collections; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.Serialization; using System.Text.RegularExpressions; using System.Text; using System;
class Solution {
}