From 804214ab34877097b0c5a16192e134002014fd77 Mon Sep 17 00:00:00 2001 From: hsycamp Date: Fri, 24 May 2019 16:06:03 +0900 Subject: [PATCH 1/3] =?UTF-8?q?H-Index=20=EB=AC=B8=EC=A0=9C=ED=92=80?= =?UTF-8?q?=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 190524/h_index.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 190524/h_index.py diff --git a/190524/h_index.py b/190524/h_index.py new file mode 100644 index 0000000..b2a4570 --- /dev/null +++ b/190524/h_index.py @@ -0,0 +1,10 @@ +def solution(citations): + citations.sort(reverse=True) + for i in range(citations[0], -1, -1): + count = 0 + std = i + for j in citations: + if j >= std: + count += 1 + if count >= std: + return std From 509981d2f49da9cd5c0d9ffcd65f9222c5002a0a Mon Sep 17 00:00:00 2001 From: hsycamp Date: Fri, 24 May 2019 16:08:59 +0900 Subject: [PATCH 2/3] =?UTF-8?q?H-Index=20=EB=AC=B8=EC=A0=9C=ED=92=80?= =?UTF-8?q?=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 190524/h_index.py | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 190524/h_index.py diff --git a/190524/h_index.py b/190524/h_index.py deleted file mode 100644 index b2a4570..0000000 --- a/190524/h_index.py +++ /dev/null @@ -1,10 +0,0 @@ -def solution(citations): - citations.sort(reverse=True) - for i in range(citations[0], -1, -1): - count = 0 - std = i - for j in citations: - if j >= std: - count += 1 - if count >= std: - return std From f834b091de5277c12f4d2d0e929d42998fbed7f0 Mon Sep 17 00:00:00 2001 From: hsycamp Date: Mon, 27 May 2019 21:19:49 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=EB=AA=A8=EC=9D=98=EA=B3=A0=EC=82=AC=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 190527/H/exam.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 190527/H/exam.py diff --git a/190527/H/exam.py b/190527/H/exam.py new file mode 100644 index 0000000..9fd5582 --- /dev/null +++ b/190527/H/exam.py @@ -0,0 +1,17 @@ +def solution(answers): + person1 = [1, 2, 3, 4, 5] + person2 = [2, 1, 2, 3, 2, 4, 2, 5] + person3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5] + count = [0, 0, 0] + result = [] + for idx, answer in enumerate(answers): + if answer == person1[idx % len(person1)]: + count[0] += 1 + if answer == person2[idx % len(person2)]: + count[1] += 1 + if answer == person3[idx % len(person3)]: + count[2] += 1 + for idx, c in enumerate(count): + if c == max(count): + result.append(idx+1) + return result