Created
February 14, 2014 10:31
-
-
Save eric-taix/8998951 to your computer and use it in GitHub Desktop.
Codingame temperature challenge solution in Dart
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
// 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