You are given an n x n binary grid of 0’s and 1’s. Your task is to represent this grid with a Quad-Tree. A Quad-Tree is a tree structure where each node has four children. Each internal node has two properties: val (True for a grid of 1’s or False for a grid of 0’s) and isLeaf (True if the node is a leaf, False if it has children). If the entire grid has the same value, the node is a leaf. If not, the grid is divided into four sub-grids, and the process is repeated recursively for each sub-grid. Your goal is to return the root of the Quad-Tree that represents the grid.
Given an array of intervals, where each interval is represented by a pair of integers [start, end], the goal is to determine the minimum number of intervals to remove to make the rest non-overlapping. Intervals that only touch at a point are considered non-overlapping.
You are given an array of intervals, where each interval is represented by a pair of integers [start, end], and the start value is unique. For each interval, find the right interval. The right interval for an interval i is an interval j such that start[j] >= end[i] and the start[j] is minimized. If no right interval exists, return -1.
You are given n distinct points in the 2D plane. A boomerang is defined as a tuple of three points (i, j, k) where the distance between points i and j equals the distance between points i and k. Count the total number of boomerangs that can be formed from the given points.
There are several balloons attached to a flat wall, represented as intervals along the x-axis. Each balloon’s horizontal span is given by a pair of integers [xstart, xend], and you must find the minimum number of arrows required to burst all the balloons. An arrow travels infinitely upwards and bursts any balloon that overlaps with its path.
You are given four integer arrays nums1, nums2, nums3, and nums4 all of length n. Your task is to find the number of quadruples (i, j, k, l) such that nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0. The indices i, j, k, and l should be between 0 and n-1.