Skip to content

Files

Latest commit

author
Khanh Do
May 24, 2020
a282590 · May 24, 2020

History

History
18 lines (15 loc) · 922 Bytes

README.md

File metadata and controls

18 lines (15 loc) · 922 Bytes

LeetCode Python Solutions

This repo contains my Python solutions to LeetCode problems. I try to give ample documentation to maximize the pedagogy of my solutions, including time and space complexity and how I arrive at them.

For expediency, when problems involve an array, I am OK with using a Python list instead and using the following operations:

  • for i in range(n): to iterate over indexes
  • for i in range(bigger, smaller, -1): to iterate backwards
  • for num in nums: to iterate over values
  • for i, num in enumerate(nums): to iterate over indexes and values simultaneously
  • nums[-1] to get the last element

While these operations are indeed Pythonic, they don't fundamentally provide any extra functionality over a low-level array. No shortcuts are intentionally made to evade the topic(s) or data structure(s) that the question is testing.

I very much welcome suggestions and corrections. Thanks.