You are given an integer array arr of length n, where the array is a permutation of integers in the range [0, n - 1]. Your task is to split this array into as many chunks (or partitions) as possible, where each chunk can be individually sorted. After sorting each chunk, when concatenated, the result should be the same as the fully sorted array. Return the largest number of chunks that you can create to achieve the sorted array.
You are given several cars starting at different positions along a road. Each car has a specific speed and is trying to reach a target destination. A car cannot pass another car, but it can catch up and travel at the speed of the slower car. Cars that travel together form a fleet. Your task is to determine the number of car fleets that will reach the target.
Design a system that processes daily stock price quotes and computes the price span for the current day. The price span for a day is defined as the maximum number of consecutive days (including today) where the price of the stock was less than or equal to today’s price.
Given an array of integers arr, find the sum of the minimum values of all contiguous subarrays of arr. Since the result can be very large, return it modulo 10^9 + 7.
You are given an integer array nums. A ramp in the array is a pair of indices (i, j) where i < j and nums[i] <= nums[j]. The width of the ramp is calculated as the difference between j and i (i.e., j - i). Your task is to find the maximum width of a ramp in the given array. If no such ramp exists, return 0.
You are given an array representing the preorder traversal of a binary search tree (BST). Your task is to construct the BST from this preorder traversal and return the root of the tree.