摘要: Given a binary tree, return all root-to-leaf paths. Solution 1: 1 /** 2 * Definition of TreeNode: 3 * public class TreeNode { 4 * public int val; 5 * 阅读全文
posted @ 2021-10-28 13:36 xuan_abc 阅读(23) 评论(0) 推荐(0) 编辑
摘要: Implement a SnapshotArray that supports the following interface: SnapshotArray(int length) initializes an array-like data structure with the given len 阅读全文
posted @ 2020-06-15 10:36 xuan_abc 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文
posted @ 2020-06-15 05:51 xuan_abc 阅读(95) 评论(0) 推荐(0) 编辑
摘要: Given a word and a dictionary, determine if it can be composed by concatenating words from the given dictionary. Assumptions The given word is not nul 阅读全文
posted @ 2020-06-14 02:23 xuan_abc 阅读(75) 评论(0) 推荐(0) 编辑
摘要: A company has n employees with a unique ID for each employee from 0 to n - 1. The head of the company has is the one with headID. Each employee has on 阅读全文
posted @ 2020-06-12 02:33 xuan_abc 阅读(215) 评论(0) 推荐(0) 编辑
摘要: There are N network nodes, labelled 1 to N. Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v  阅读全文
posted @ 2020-06-08 07:26 xuan_abc 阅读(166) 评论(0) 推荐(0) 编辑
摘要: For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees. A binary tree X is flip e 阅读全文
posted @ 2020-06-07 23:46 xuan_abc 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Given two sequences pushed and popped with distinct values, return true if and only if this could have been the result of a sequence of push and pop o 阅读全文
posted @ 2020-06-07 23:09 xuan_abc 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Alice has a hand of cards, given as an array of integers. Now she wants to rearrange the cards into groups so that each group is size W, and consists 阅读全文
posted @ 2020-06-07 21:59 xuan_abc 阅读(108) 评论(0) 推荐(0) 编辑
摘要: You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rota 阅读全文
posted @ 2020-06-07 11:04 xuan_abc 阅读(129) 评论(0) 推荐(0) 编辑