Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Test3
//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) { List<List<int>> list = new List<List<int>>(); list.Add(new List<int>(new int[]{1,2,3,4,5,6})); list.Add(new List<int>(new int[]{1,2,3,4,5,7})); list.Add(new List<int>(new int[]{1,2,3,4,5,8})); list.Add(new List<int>(new int[]{1,2,3,4,5,9})); list.Add(new List<int>(new int[]{1,2,3,4,9})); list.Add(new List<int>(new int[]{1,2,3,9})); List<int> list_new = new List<int>(new int[]{1,2,3,4,5,6,9}); //List<int> list_new = new List<int>(list[4]); /*foreach (var obj in list) { foreach (var obj2 in obj) { Console.Write(obj2); } Console.WriteLine(); }*/ //Console.WriteLine(listMatched(list[3],list_new)); Console.WriteLine(listMatchedInList(list, list_new)); } public static bool listMatchedInList(List<List<int>> lists, List<int> list1) { int passes = 0; for (int i=0; i < lists.Count; i++) { if (listMatched(lists[i],list1)) { return true; } else { passes++; } } // end for loop if (passes<lists.Count-1) return true; else return false; } public static bool listMatched(List<int> list1, List<int> list2) { list1.Sort(); list2.Sort(); int passes = 0; if (list1.Count!=list2.Count) return false; else { for (int i=0; i<list1.Count; ++i) { if (list1[i] == list2[i]) { passes++; } } if (passes==list1.Count) return true; else return false; } } public static List<int> Sort(List<int> list) { /*int temp = list[0]; list[0] = list[list.Count-1]; list[list.Count-1] = temp; */ bool sorted = false; int passes = 0; while (passes!=list.Count-2) { for (int i = 0; i < list.Count - 1; i++ ) { if (passes<list.Count-2) { if (list[i] <= list[i+1]) { passes++; } else { int temp = list[i]; list[i] = list[i+1]; list[i+1] = temp; passes =0; } } } } return list; } } }
run
|
edit
|
history
|
help
0
XmlException in XmlSerializer.Deserialize when XML has \0
Unix timestamp to DateTime
Some C# advanced stuff
Delegaty Func
CODE
Binary search tree - Post-order Traversal
test device logger
Enigme
n th to last element
sdcasdcasdcsadxcd