From d86e3334b1a9cd7373a5c83dfe1b258258c9d816 Mon Sep 17 00:00:00 2001 From: Sangeeth Sudheer Date: Thu, 21 Apr 2022 15:14:12 +0530 Subject: [PATCH] improved top-k --- 0347_top-k-frequent-elements/python3/bucketsort.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/0347_top-k-frequent-elements/python3/bucketsort.py b/0347_top-k-frequent-elements/python3/bucketsort.py index 2d5cb66..3dfd932 100644 --- a/0347_top-k-frequent-elements/python3/bucketsort.py +++ b/0347_top-k-frequent-elements/python3/bucketsort.py @@ -36,11 +36,6 @@ class Solution: # Possible that we filled k elements already in this inner # loop, so get out if len(result) == k: - break - - if len(result) == k: - break + return result j -= 1 - - return result