LeetCode: 108. Convert Sorted Array to Binary Search Tree 解題紀錄
題目
Given an integer array nums
where the elements are sorted in ascending order, convert it to a height-balanced binary search tree.
Given an integer array nums
where the elements are sorted in ascending order, convert it to a height-balanced binary search tree.
You are given a 0-indexed array nums
consisting of positive integers.
There are two types of operations that you can apply on the array any number of times:
Read More »LeetCode: 2870-Minimum Number of Operations to Make Array Empty 解題紀錄Given n
points
on a 2D plane where points[i] = [xi, yi]
, Return the widest vertical area between two points such that no points are inside the area.
You are given an integer array prices
representing the prices of various chocolates in a store. You are also given a single integer money
, which represents your initial amount of money.
An image smoother is a filter of the size 3 x 3
that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not present, we do not consider it in the average (i.e., the average of the four cells in the red smoother).
Design a food rating system that can do the following:
Given two strings s
and t
, return true
if t
is an anagram of s
, and false
otherwise.
You are given the array paths
, where paths[i] = [cityAi, cityBi]
means there exists a direct path going from cityAi
to cityBi
. Return the destination city, that is, the city without any path outgoing to another city.
You are given a 0-indexed m x n
binary matrix grid
.
A 0-indexed m x n
difference matrix diff
is created with the following procedure: