Created
March 9, 2021 21:42
-
-
Save terror/5699f3a2256c04e8913d74d4ad11ef68 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
using System; | |
using System.Collections.Generic; | |
class Program { | |
static void Main(string[] args) { | |
List<List<int>> arr = new List<List<int>>(); | |
// -> [] | |
for(int i = 0; i < 10; ++i) { | |
arr.Add(new List<int>()); | |
} | |
// -> [[], [], [], [], [] ... etc] | |
for(int i = 0; i < 10; ++i) { | |
for(int j = 0; j < 10; ++j) | |
arr[i].Add(j); | |
} | |
// I | |
foreach(List<int> i in arr) { | |
foreach(int j in i) | |
Console.Write(j + " "); | |
Console.WriteLine(); | |
} | |
// II | |
for(int i = 0; i < arr.Count; ++i) { | |
for(int j = 0; j < arr[0].Count; ++j) | |
Console.Write(j + " "); | |
Console.WriteLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment