From cef43f23e0aa03f3bd68bc3fb5ef321a79ae3a52 Mon Sep 17 00:00:00 2001 From: Seongbeom Park Date: Tue, 10 May 2022 22:31:40 +0900 Subject: [PATCH] finish extra/skipping-work Submitting solution... Submission: SUCCESSFUL. Completed in: 20 mins, 58 secs. --- README.md | 3 +++ extra/skipping-work/solution.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 extra/skipping-work/solution.py diff --git a/README.md b/README.md index 543eb5d..fe116a7 100644 --- a/README.md +++ b/README.md @@ -105,3 +105,6 @@ CFcSBwgCCBoHRhkKU1cGAA4AGU5YQR5THBwNFwoGGAxTQQMQVBUSBg4EAAwQRhUQVBUHFAQTGRpT QQM ### numbers-station-coded-messages * Completed in: 10 mins, 1 secs. + +### skipping-work +* Completed in: 20 mins, 58 secs. diff --git a/extra/skipping-work/solution.py b/extra/skipping-work/solution.py new file mode 100644 index 0000000..6979374 --- /dev/null +++ b/extra/skipping-work/solution.py @@ -0,0 +1,14 @@ +def solution(x, y): + p, q = (sorted(x), sorted(y)) if len(x) > len(y) else (sorted(y), sorted(x)) + for i, v in enumerate(p): + if v != q[i]: + return v + +tests = [ + ([[13, 5, 6, 2, 5], [5, 2, 5, 13]], 6), + ([[14, 27, 1, 4, 2, 50, 3, 1], [2, 4, -4, 3, 1, 1, 14, 27, 50]], -4), + ] + +for i, o in tests: + result = solution(*i) + print (i, result == o, result, o)