摘要: You have an array of logs. Each log is a space delimited string of words. For each log, the first word in each log is an alphanumeric identifier. Then 阅读全文
posted @ 2020-08-20 07:39 little_veggie 阅读(102) 评论(0) 推荐(0)
摘要: There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next r 阅读全文
posted @ 2020-08-19 11:27 little_veggie 阅读(190) 评论(0) 推荐(0)
摘要: A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given a non-empty strin 阅读全文
posted @ 2020-08-18 04:55 little_veggie 阅读(171) 评论(0) 推荐(0)
摘要: Given a binary tree, return the inorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [1,3,2] Follow up: Recursive so 阅读全文
posted @ 2020-08-15 13:53 little_veggie 阅读(72) 评论(0) 推荐(0)
摘要: Given a binary tree, return the postorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [3,2,1] Follow up: Recursive 阅读全文
posted @ 2020-08-15 05:38 little_veggie 阅读(78) 评论(0) 推荐(0)
摘要: Given a binary tree, return the preorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [1,2,3] Follow up: Recursive s 阅读全文
posted @ 2020-08-15 05:02 little_veggie 阅读(103) 评论(0) 推荐(0)
摘要: Given a sentence text (A sentence is a string of space-separated words) in the following format: First letter is in upper case. Each word in text are 阅读全文
posted @ 2020-08-14 08:01 little_veggie 阅读(172) 评论(0) 推荐(0)
摘要: 1. 高效运输 输入:产品i有boxes[i]箱, 每箱装unitsPerBox[i]个,卡车最多装truckSize箱 输出:一车能运的max units Greedy, 用map扫一遍。 2. 快乐字母异位词 输入:a list of strings 输出:如果cur是之前某个str的anagr 阅读全文
posted @ 2020-08-14 06:16 little_veggie 阅读(194) 评论(0) 推荐(0)
摘要: Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's triangle. Note that the row index starts from 0. In Pascal's trian 阅读全文
posted @ 2020-08-13 05:01 little_veggie 阅读(70) 评论(0) 推荐(0)
摘要: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). F 阅读全文
posted @ 2020-08-13 03:14 little_veggie 阅读(70) 评论(0) 推荐(0)