Top 100 Liked Questions (in Python)

2432The Employee That Worked on the Longest Task

  • 宣告變數:

n = 10 

logs = [[0,3],[2,5],[0,9],[1,15]]

  • for loop:

for i in range(len(logs)):

  • print with string and number:

print('id is', id, 'time is', time) 

  • Skip first element (for 1D array):
using slice
  • Skip first element (for 2D array):
for i in range(1, len(logs)): 

94Binary Tree Inorder Traversal
  • preorder 中 -> 左 -> 右inorder 左 -> 中 -> 右, postoreder 左 -> 右 -> 中
  • Binary Tree Traversal implement: recursive, iterative
121Best Time to Buy and Sell Stock

160. Intersection of Two Linked Lists

留言