Created with <3 with dartpad.dev.
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(oneEditApart("cat", "cut")); | |
print(oneEditApart("cat", "dog")); | |
print(oneEditApart("cat", "cats")); | |
print(oneEditApart("cat", "act")); | |
print(oneEditApart("cat", "acts")); | |
print(oneEditApart("cat", "at")); | |
print(oneEditApart("cat", "cast")); | |
} |
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 combination(List<String> list, int n) { | |
List<int> iList = List.generate(n, (_) => 0); | |
int max = iList.length - 1; | |
while (iList.last <= max) { | |
print(iList.map((e) => list[e])); // здесь берем массив и делаем че хотим | |
if (iList.last == max) { | |
if (addDecimal(iList, max)) { | |
continue; |
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(){ | |
var ellipse = Ellipse(); | |
var triangle = Triangle(); | |
var composite = CompositeGraphic(); | |
ellipse.info(); | |
triangle.info(); | |
composite.add(ellipse); | |
composite.add(triangle); | |
composite.info(); |
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(Builder('some_table') | |
..select(['name']).where('a', '<=', 'b').limit(1) | |
..insert({'id': 1, 'name': 'First'}) | |
..build(), | |
); | |
print(Where('a', '<=', '10', or: Where('b', '>=', '10')).build()); | |
} | |
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
// ignore_for_file: curly_braces_in_flow_control_structures | |
/* | |
* Performance benchmark of different ways to concat strings. | |
* | |
* For small string: | |
* Length: 3000 | |
* StringBuffer: 7 us. | |
* Concatenation: 38 us. | |
* Interpolation: 45 us. |
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
/// Паттерн "Цепочка обязанностей" | |
/// | |
/// Полезно: | |
/// - Если есть какая-то группа объектов, которая может обработать | |
/// какой-то запрос (сообщение). | |
/// - Не важно каким именно объектов из этой группы будет обработано сообщение. | |
/// | |
/// Принцип - не смог обработать сам, отдай другому. | |
/// | |
/// Отличие от паттерна RequestHandler: |