[leetcode] 162. Find Peak Element _ Algorithm Problem Solve for python

1. Problem 162. Find Peak Element A peak element is an element that is strictly greater than its neighbors. Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks. You may imagine that nums[-1] = nums[n] = -∞. In other words, an element is al...

Read more

[leetcode] 198. House Robber _ Algorithm Problem Solve for python

1. Problem 198. House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken in...

Read more

[leetcode] 101. Symmetric Tree _ Algorithm Problem Solve for python

1. Problem 101. Symmetric Tree Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Example 1: Input: root = [1,2,2,3,4,4,3] Output: true Example 2: Input: root = [1,2,2,null,3,null,3] Output: false Constraints: The number of nodes in the tree is in the range [1, 1000]. -100 &l...

Read more