Skip to content

Instantly share code, notes, and snippets.

@eric-taix
Created February 14, 2014 10:31
Show Gist options
  • Save eric-taix/8998951 to your computer and use it in GitHub Desktop.
Save eric-taix/8998951 to your computer and use it in GitHub Desktop.
Codingame temperature challenge solution in Dart
// Codingame temperature challenge solution in Dart
// Eric Taix
import 'dart:io';
void main() {
print(int.parse(stdin.readLineSync()) == 0 ? 0 : stdin.readLineSync().split(' ').map((s) => int.parse(s))
.fold(10000,(r,i) => i.abs() == r.abs() ? (i > r ? i : r) : i.abs().compareTo(r.abs()) == -1 ? i : r));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment