using System.Collections.Generic;
public static void Main()
List<int> Testlst = new List<int> {1, 0, 0, 0, 2, 0};
Console.WriteLine(GetMinTime(Testlst));
public static string GetMinTime(List<int> lst)
foreach(int num in lst) sum += num;
lst = GetComb(new List<int>(), lst);
return lst[0].ToString() + lst[1].ToString() + ":" +
lst[2].ToString() + lst[3].ToString() + ":" +
lst[4].ToString() + lst[5].ToString();
public static List<int> GetComb(List<int> res, List<int> lst)
Continue = !CheckValidity(res);
for(int i=0; i< lst.Count; i++)
res.RemoveAt(res.Count -1);
public static bool CheckValidity(List<int> res)
return (((res[0] == 2 && res[1] < 4) || (res[0] < 2 && res[1] < 10)) && (res[2] < 6) && (res[3] < 10) && (res[4] < 6) && (res[5] < 10));