1 Algorithm
1.1 problem
1.2 solution
First solution is using two for
sentences,but the complexity is O(n^2);we can use the hash map.
class Solution:
def twoSum(self, nums, target):
hash_map = dict()
for i,x in enumerate(nums):
if target - x in hash_map:
return [i,hash_map[target-x]]
hash_map[x] = i
2 Review
10 Basic Programming Principles Every Programmer Must Follow
I think these tips is very good for us to cooperate with the other team members. I suppose the software is art the same as the architecture,but when we pursue the excellent skills, we must remember why we need write code.
3 Tip
Create a MSBuild Project
when our team use the visual studio to develop software, many times unexpected error occurs in our project, so we can write the project file line by line, it can decrease many bugs.
4 Share
Recursion play an important role in the algorithm. I think the recursion is a way that thinking from end to start. In our life, I supposed that thinking how to living from the death to now is better than thinking now based the future. The idea called by Chinese is "向死而生".
网友评论