Dart algorithm practices