LeetCode: 606-Construct String from Binary Tree 解題紀錄
題目
Given the root
of a binary tree, construct a string consisting of parenthesis and integers from a binary tree with the preorder traversal way, and return it.
Given the root
of a binary tree, construct a string consisting of parenthesis and integers from a binary tree with the preorder traversal way, and return it.
You are given a string num
, representing a large integer. Return the largest-valued odd integer (as a string) that is a non-empty substring of num
, or an empty string ""
if no odd integer exists.
There are 3n
piles of coins of varying size, you and your friends will take piles of coins as follows:
You are given a 0-indexed array of strings garbage
where garbage[i]
represents the assortment of garbage at the ith
house. garbage[i]
consists only of the characters 'M'
, 'P'
and 'G'
representing one unit of metal, paper and glass garbage respectively. Picking up one unit of any type of garbage takes 1
minute.
You are given four integers sx
, sy
, fx
, fy
, and a non-negative integer t
.
In an infinite 2D grid, you start at the cell (sx, sy)
. Each second, you must move to any of its adjacent cells.
You are playing a video game where you are defending your city from a group of n monsters. You are given a 0-indexed integer array dist of size n, where dist[i] is the initial distance in kilometers of the ith monster from the city.
Read More »LeetCode: 1921-Eliminate Maximum Number of Monsters 解題紀錄Given an integer columnNumber
, return its corresponding column title as it appears in an Excel sheet.
There is an integer array nums
sorted in ascending order (with distinct values).
Given a directed acyclic graph, with n
vertices numbered from 0
to n-1
, and an array edges
where edges[i] = [fromi, toi]
represents a directed edge from node fromi
to node toi
.