This file contains hidden or 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
void main() { | |
List<dynamic> numberIteration = []; | |
Map<String, int> counter = {}; | |
for (var i = 1; i <= 100; i++) { | |
if (i % 3 == 0 && i % 5 == 0) { | |
numberIteration.add("FizzBuzz"); | |
print("FizzBuzz"); | |
} else if (i % 3 == 0) { | |
numberIteration.add("Fizz"); |
This file contains hidden or 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
class Student { | |
String name; | |
int id; | |
List<String> enrolledCourses = []; | |
Student({required this.name, required this.id}); | |
void enrollInCourse(String course) => enrolledCourses.add(course); | |
} |
This file contains hidden or 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
List<List<int>> pascalsTriangle(int numRows) { | |
if (numRows < 1 || numRows > 30) { | |
throw ArgumentError("Number of Rows must not be lower than 1 or exceed 30"); | |
} | |
List<List<int>> triangle = []; | |
for (int i = 0; i < numRows; i++) { | |
triangle.add([]); | |
for (int j = 0; j <= i; j++) { |
This file contains hidden or 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
dynamic romanNumeralConvertor(String s) { | |
final pattern = RegExp(r'^[IVXLCDM]+$'); | |
var integerValues = { | |
'I': 1, | |
'V': 5, | |
'X': 10, | |
'L': 50, | |
'C': 100, | |
'D': 500, | |
'M': 1000, |