Commit 881ce55c by bonnieyan

Merge branch 'master' of 47.94.6.102:525663314/1-homework-yanjun

parents 02277a14 cde2f2e1
...@@ -16,6 +16,10 @@ class ListNode: ...@@ -16,6 +16,10 @@ class ListNode:
class Solution: class Solution:
#这里不需要做递归 时间复杂度比较高
#可以考虑用遍历方式去实现
#具体算法参考归并排序
def mergeTwoLists(self, l1, l2): def mergeTwoLists(self, l1, l2):
""" """
:type l1: ListNode :type l1: ListNode
......
...@@ -77,3 +77,4 @@ if __name__ == "__main__": ...@@ -77,3 +77,4 @@ if __name__ == "__main__":
#ok
\ No newline at end of file
...@@ -26,3 +26,5 @@ ...@@ -26,3 +26,5 @@
select name, population, area from World where area > 3000000 or population > 25000000 select name, population, area from World where area > 3000000 or population > 25000000
#ok
\ No newline at end of file
...@@ -10,3 +10,5 @@ def bubbleSort(A): ...@@ -10,3 +10,5 @@ def bubbleSort(A):
if __name__ == '__main__': if __name__ == '__main__':
bubbleSort([1,15,2,5,3,18,6]) bubbleSort([1,15,2,5,3,18,6])
#ok
\ No newline at end of file
...@@ -22,3 +22,4 @@ def convert(s, numRows): ...@@ -22,3 +22,4 @@ def convert(s, numRows):
print(convert("LEETCODEISHIRING",4)) print(convert("LEETCODEISHIRING",4))
print(convert("LEETCODEISHIRING",3)) print(convert("LEETCODEISHIRING",3))
#ok
\ No newline at end of file
...@@ -46,3 +46,4 @@ s = "The quick brown fox jumped over the lazy dog".split(' ') ...@@ -46,3 +46,4 @@ s = "The quick brown fox jumped over the lazy dog".split(' ')
#print(s) #print(s)
print(goat_latin(s)) print(goat_latin(s))
#ok
\ No newline at end of file
...@@ -38,3 +38,4 @@ p.get_emails() ...@@ -38,3 +38,4 @@ p.get_emails()
p.get_ips() p.get_ips()
p.get_phone_numbers() p.get_phone_numbers()
p.get_urls() p.get_urls()
#ok
\ No newline at end of file
class SortUtils: class SortUtils:
def sort(self, f, s): def sort(self, f, s):
if f == "bubble": if f == "bubble":
#最好写成函数调用
for i in range(len(s) - 1): for i in range(len(s) - 1):
for j in range(len(s) - i - 1): for j in range(len(s) - i - 1):
if s[j] > s[j+1]: if s[j] > s[j+1]:
...@@ -8,6 +9,8 @@ class SortUtils: ...@@ -8,6 +9,8 @@ class SortUtils:
print(s) print(s)
#print(s) #print(s)
if f == "quick": if f == "quick":
#这里可以通过使用构造方法来处理
#如果使用这一调用方法里面的self就没有意义的 可以用静态装饰器
SortUtils.__quick_sort(self, s, 0, len(s)-1) SortUtils.__quick_sort(self, s, 0, len(s)-1)
def __quick_sort(self, sort_list, start_index, end_index): def __quick_sort(self, sort_list, start_index, end_index):
......
...@@ -18,3 +18,5 @@ class Heater: ...@@ -18,3 +18,5 @@ class Heater:
h = Heater() h = Heater()
result = h.findRadius([1, 2, 3, 4, 6], [1, 4]) result = h.findRadius([1, 2, 3, 4, 6], [1, 4])
print(result) print(result)
#ok
\ No newline at end of file
...@@ -35,3 +35,4 @@ matrix = [[1, 2, 3, 4], [5, 1, 2, 3], [9, 5, 1, 2]] ...@@ -35,3 +35,4 @@ matrix = [[1, 2, 3, 4], [5, 1, 2, 3], [9, 5, 1, 2]]
result = m.topu_matrix(matrix) result = m.topu_matrix(matrix)
print(result) print(result)
#ok
\ No newline at end of file
...@@ -5,6 +5,7 @@ class node(): ...@@ -5,6 +5,7 @@ class node():
self.right = r self.right = r
#这里可以不用递归实现 做一遍遍历就行了
def listcreattree(root, llist, i): def listcreattree(root, llist, i):
if i < len(llist): if i < len(llist):
if llist[i] == 'null': if llist[i] == 'null':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment