Insert Interval
Text Justification
68. Text Justification
Given an array of words and a width
maxWidth, format the text such that each line as exactlymaxWidthcharacters and is fully (left and right) justified.
题目的意思是, 给一个数组, 数组里面有$n$个单词, 把这些单词按照maxWidth行存放. 每一行的两端要对齐.
需要注意的是
- 单词的顺序不能改变
- 如果一行之后一个单词, 那么这个单词要左对齐
- 如果空格不能均匀分布在所有间隔当中, 则左边的空格需要比右边的空格多
- 每行要尽可能多的放单词
Increasing Triplet Subsequence
Two Sum IV - Input is a BST
Word Search
79. Word Search
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or vertically neighboring. The same letter cell may not used more than once.
题目的意思是, 给一个2d的数组, 和一个字符串, 要求返回数组里面是否可以由相邻的字母组成这个字符串.
例子如下:
[
[A, B, C, E]
[S, F, C, S]
[A, D, E, E]
]
word = ABCCED -> true
ABCCED 可以由 (0, 0) -> (0, 1) -> (0, 2) -> (1, 2) -> (2, 2) -> (2, 1) 组成.
Product of Array Except Self
238. Product of Array Except
Given an array
numsof $n$ integers where $n>1$, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elemetns ofnumsexceptnums[i]
题目说的是, 给一个array, 要求返回另外一个数组. 要求是, 返回的数组里面的是原数组其他数的乘积.
比如说:[1, 2, 3, 4]是输入, 那么输出是 [24, 12, 8, 6]. 因为 $24 = 2 \times 3 \times 4$, $12 = 1 \times 3 \times 4$.