leetcode's People
leetcode's Issues
Stack
Stack is used for list (?).
Python supports ls.pop(i) to pop the ith element. (not only first in first out)
Whenever ls.pop() is called, ls will be left with n-1 elements. (eg, a = ls.pop(i), a is assigned ls[i], but ls has all the elements but ls[i]) (??? weird)
Symmetric tree
101: a good one.
Can be solved recursively and iteratively.
Link: https://leetcode.com/problems/symmetric-tree/discuss/33050/Recursively-and-iteratively-solution-in-Python
Should go over again.
104: similar one.
Recursion is more straight-forward. Space complexity is O(logn).
Iteration takes advantage of DFS and stacks. Space complexity is O(n).
Linked list
21
Using recursive approach, I guess?
Cannot understand syntax of the Linked list and Node!
206
Reversing a linked list.
It's about pointers. (?) Just figured out the iterative one.
DP (wth???)
70, Fibonacci problem.
Most straight-forward approach: top-down recursive. Time complexity is larger. (link: https://leetcode.com/problems/climbing-stairs/discuss/163347/Python-3000DP-or-tm )
Alternative: bottom-up using array (or better). Faster.
Or, top-down dictionary. Not fast. (link: https://leetcode.com/problems/climbing-stairs/discuss/25313/Python-different-solutions-(bottom-up-top-down).)
Anyway, not yet found a efficient solution for Python?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.