LeetCode: 230-Kth Smallest Element in a BST 解題紀錄
題目
Given the root
of a binary search tree, and an integer k
, return the kth
smallest value (1-indexed) of all the values of the nodes in the tree.
Given the root
of a binary search tree, and an integer k
, return the kth
smallest value (1-indexed) of all the values of the nodes in the tree.
Given the root
of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child.
You are keeping score for a baseball game with strange rules. The game consists of several rounds, where the scores of past rounds may affect future rounds' scores.
Read More »LeetCode: 682-Baseball Game 解題紀錄You are given an array of integers stones
where stones[i]
is the weight of the ith
stone.
Given a string s
, return true
if the s
can be palindrome after deleting at most one character from it.
Write a function that reverses a string. The input string is given as an array of characters s
.
Given an array nums
which consists of non-negative integers and an integer m
, you can split the array into m
non-empty continuous subarrays.
There is an integer array nums
sorted in non-decreasing order (not necessarily with distinct values).
You are given an m x n
binary matrix mat
of 1
's (representing soldiers) and 0
's (representing civilians). The soldiers are positioned in front of the civilians. That is, all the 1
's will appear to the left of all the 0
's in each row.