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
// O(1) | |
// constant | |
bool isFirstElementNull(List<String> elements) { | |
return elements.first == null; | |
} | |
// O(n) | |
// growth is linear in direct proportion to the size of the data set | |
bool containsValue(List<String> elements, String value) { | |
for (String element in elements) { |
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 arr = []; | |
for (int i = 0; i < 100; i++) { | |
arr.add(i.toString()); | |
} | |
int page = 1; | |
var startIndex = -1, endIndex = -1; | |
while (arr.length > 0 && endIndex != (arr.length - 1)) { | |
startIndex = (page - 1) * 10; |