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() | |
{ | |
print("Hello World!"); | |
} |
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<int> exampleNumbers = [121, 1221, 1231, 5431, 12321]; | |
print("Palindrome Checker"); | |
for (final num in exampleNumbers) { | |
print(isPalindromeNumber(num)); | |
} | |
print("Roman To Int"); | |
print(romanToInt("III")); // 3 | |
print(romanToInt("LVIII")); // 58 | |
print(romanToInt("MCMXCIV")); // 1994 |
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>> generate(int numRows) { | |
// Constraints: 1 <= numRows <= 30 | |
if (numRows < 1 || numRows > 30) { | |
print("Error: numRows must be between 1 and 30"); | |
return []; | |
} | |
List<List<int>> triangle = []; | |
for (int i = 0; i < numRows; i++) { | |
List<int> row = List.filled(i + 1, 1); |
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 FizzBuzzin() { | |
List<dynamic> storedIteration = []; | |
for (int num = 1; num <= 100; num++) { | |
if (num % 3 == 0 && num % 5 == 0) { | |
print("FizzBuzz"); | |
storedIteration.add("FizzBuzz"); | |
} else if (num % 3 == 0) { | |
print("Fizz"); | |
storedIteration.add("Fizz"); | |
} else if (num % 5 == 0) { |
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(this.name, this.id, this.enrolledCourses); | |
void enrollInCourse(String course) => enrolledCourses.add(course); | |
} |