[Leetcode/파이썬] 35. Search Insert Position
Search Insert PositionGiven a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You must write an algorithm with O(log n) runtime complexity. Example 1:Input: nums = [1,3,5,6], target = 5Output: 2Example 2:Input: nums = [1,3,5,6], target = 2Output: 1Example 3:Input: nums = [1,3,5,..
더보기
[Leetcode/파이썬] 221. Maximal Square
Maximal SquareGiven an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example 1:Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]Output: 4Example 2:Input: matrix = [["0","1"],["1","0"]]Output: 1Example 3:Input: matrix = [["0"]]Output: 0 Constraints:m == matrix.lengthn == matrix[..
더보기
[Leetcode/파이썬] 100.Same Tree
Same TreeGiven the roots of two binary trees p and q, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. Example 1:Input: p = [1,2,3], q = [1,2,3]Output: trueExample 2:Input: p = [1,2], q = [1,null,2]Output: falseExample 3:Input: p = [1,2,1], q = [1,1,2]Output: false Constraints:The..
더보기