31. Next Permutation

```python class Solution: def nextPermutation(self, nums: List[int]) -> None: “”” Do not return anything, modify nums in-place instead. “”” # main idea is to (1) find a larger number than current nums (2) increment between next bigger and current number is as small as possible ==> start from lower digit/... [Read More]
Tags: Array

112. Path Sum

```python Definition for a binary tree node. class TreeNode: def init(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right time O(N) space O(H) H: stack class Solution: def hasPathSum(self, root: TreeNode, sum: int) -> bool: if not root: return False if not root.left and not root.right... [Read More]
Tags: Tree DFS