427. Construct Quad Tree

Given a n * n matrix grid of 0’s and 1’s only. We want to represent the grid with a Quad-Tree. Return the root of the Quad-Tree representing the grid. Notice that you can assign the value of a node to True or False when isLeaf is False, and both are accepted in the answer. A Quad-Tree is a tree data structure in which each internal node has exactly four children....

<span title='2021-11-30 00:00:00 +0000 UTC'>November 30, 2021</span>&nbsp;·&nbsp;5 min&nbsp;·&nbsp;volyx

34. Find First and Last Position of Element in Sorted Array

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1]. You must write an algorithm with O(log n) runtime complexity. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Example 1: Input: nums = [5,7,7,8,8,10], target = 8 Output: [3,4] Example 2: Input: nums = [5,7,7,8,8,10], target = 6 Output: [-1,-1] Example 3: Input: nums = [], target = 0 Output: [-1,-1] Constraints:...

<span title='2021-11-13 00:00:00 +0000 UTC'>November 13, 2021</span>&nbsp;·&nbsp;4 min&nbsp;·&nbsp;volyx