File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Runtime: 28 ms, faster than 76.71% of Python online submissions for Reverse Words in a String III.
2
+ # Difficulty: Easy
3
+
4
+ class Solution (object ):
5
+ def reverseWords (self , s ):
6
+ """
7
+ :type s: str
8
+ :rtype: str
9
+ """
10
+ return ' ' .join (map (lambda word : word [::- 1 ], s .split (' ' )))
Original file line number Diff line number Diff line change
1
+ # Runtime: 112 ms, faster than 98.45% of Python online submissions for N-ary Tree Postorder Traversal.
2
+ # Difficulty: Easy
3
+
4
+ class Solution (object ):
5
+ def postorder (self , root ):
6
+ """
7
+ :type root: Node
8
+ :rtype: List[int]
9
+ """
10
+ if not root :
11
+ return []
12
+ p_list = list ()
13
+ for child in root .children :
14
+ p_list .extend (self .postorder (child ))
15
+ p_list .append (root .val )
16
+ return p_list
Original file line number Diff line number Diff line change
1
+ # Runtime: 330 ms, faster than 35.42% of MySQL online submissions for Swap Salary.
2
+ # Difficulty: Easy
3
+
4
+ UPDATE SALARY
5
+ SET sex = IF(sex = ' f' , ' m' , ' f' );
You can’t perform that action at this time.
0 commit comments