Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Found many section of times intersect.
//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; using System.Globalization; namespace Rextester { public class Program { class TimeRange { public DateTime Start{get;set;} public DateTime End{get;set;} public string Status{get;set;} } public static void Main(string[] args) { //Your code goes here Console.WriteLine("HoaND:_"); var provider = new CultureInfo("de-DE"); //var d = DateTime.ParseExact("08.05.2016", "d", provider); //Console.WriteLine(d); /* *Requirement* Test 1: => input (dd.mm.yyyy): t1 = 08.05.2016 -> 20.05.2016 t2 = 17.05.2016 -> 25.05.2016 t3 = 27.05.2016 -> 28.05.2016 => output: t1 = 08.05.2016 -> 17.05.2016, Status = normal t2 = 17.05.2016 -> 20.05.2016, Status = overlap t3 = 20.05.2016 -> 25.05.2016, Status = normal t4 = 27.05.2016 -> 28.05.2016, Status = normal Test 2: => input: t1 = 05.05.2016 -> 20.05.2016 t2 = 07.05.2016 -> 15.05.2016 t3 = 17.05.2016 -> 25.05.2016 => output: t1 = 05.05.2016 -> 07.05.2016, Status = normal t2 = 07.05.2016 -> 15.05.2016, Status = overlap t3 = 15.05.2016 -> 17.05.2016, Status = normal t4 = 17.05.2016 -> 20.05.2016, Status = overlap t5 = 20.05.2016 -> 25.05.2016, Status = normal Test3: => input: t1 = 05.05.2016 -> 07.05.2016 t2 = 15.05.2016 -> 20.05.2016 t3 = 22.05.2016 -> 25.05.2016 => output: t1 = 05.05.2016 -> 07.05.2016, Status = normal t2 = 15.05.2016 -> 20.05.2016, Status = normal t3 = 22.05.2016 -> 25.05.2016, Status = normal */ var list = new List<TimeRange>{ new TimeRange{ Start = DateTime.ParseExact("08.05.2016", "d", provider), End = DateTime.ParseExact("20.05.2016", "d", provider), Status = "" }, new TimeRange{ Start = DateTime.ParseExact("17.05.2016", "d", provider), End = DateTime.ParseExact("25.05.2016", "d", provider), Status = "" }, new TimeRange{ Start = DateTime.ParseExact("27.05.2016", "d", provider), End = DateTime.ParseExact("28.05.2016", "d", provider), Status = "" } }; Console.WriteLine("=> Input: "); foreach(var item in list){ Console.WriteLine(item.Start +" -> "+ item.End); } //Logic here //TODO: code } } }
run
|
edit
|
history
|
help
0
recur 4
Need to convert datetime containg '/' to '-' format
Fórum ➡ Rotating a Square Matrix One Cell Counter Clockwise
Multidimensional Arrays
A
Chris Kasongo Lazarius Mukengeshayi "Entelect BlackJack 21"
Frase
Q-2 dotnet
Fórum GroupBy ➡ Sum & Aggregate customers' names
D16