carbonz0 / leetcode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

leetcode

This repository is a practice area for leetcode problems. It not only focus on solving but also different solutions.

Furthermore, this repository is mainly for different implemention of problem's on leetcode.

About different between solution and implemention, For example, traversing a tree

1)DFS and BFS are considered as TWO different solutions

2)DFS by recursion and DFS by stack are considered as ONE solution, but TWO different implementions.

However, they both have BEST time complexity and space complexity.

As we know, when interview, for a problem, the requirement are higher than it in programming contests, in programming contests, we only care the algorithm complexity and program correctness, but when in interview, the interviewer often ask other question, especially about the different implemention and solution. For example, he may ask you whether you can implement without define this auxiliary varable, change recursion to stack, traverse without two queues, do not use vector, etc.

And if you practice leetcode just like other online judges, just submit and get Accepted, then throw it away, you're unable to prepare these questions. Actually, different from complexity and correctness, the implemention and solution doesn't have a BEST one and judging standard, for example, when you give interviewer an algorithm with best complexity, he may not let you to optimize, and when you give interviewer a code without bug, he may not let you to fix. but no matter what solution or implementions you give, he may still want you to change to the one he want.

You can discuss the implemention and solution together here, broaden your horizon by view other's code. Maybe it's the best way to deal with these problems.

For more

Leetcode OJ: http://leetcode.com/

Zhenyang's Post (where idea came from): https://www.facebook.com/zhenyang.dai/posts/10200471134888770?comment_id=63436649&offset=0&total_comments=4&notif_t=feed_comment_reply

About