Skip to content

Commit

Permalink
day30
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-KOUAGOU committed May 30, 2020
1 parent 835ce3b commit 9b12da1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions MayChallenge_LeetCode.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,32 @@
" self.course_status[course] = 2\n",
" return True"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## K Closest Points to Origin\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"class Solution:\n",
" def kClosest(self, points, K: int):\n",
" distance = lambda X: X[0]**2+X[1]**2\n",
" return sorted(points, key=distance)[0:K]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 9b12da1

Please sign in to comment.