摘要:
题目描述: Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum o 阅读全文
摘要:
题目描述: Given a collection of distinct integers, return all possible permutations. Example: 解题思路: 用回溯法。使用额外空间记录每个数值是否已经使用。 代码: 1 class Solution { 2 publ 阅读全文
摘要:
题目描述: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set 阅读全文
摘要:
题目描述: Given a non-empty array of integers, return the k most frequent elements. Example 1: Example 2: Input: nums = [1], k = 1 Output: [1] Example 2: 阅读全文
摘要:
题目描述: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [ 阅读全文
摘要:
题目描述: Given a binary tree, return the inorder traversal of its nodes' values. Example: 解题思路: 递归的方法。 代码: 1 /** 2 * Definition for a binary tree node. 3 阅读全文
摘要:
题目描述: Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes 阅读全文
摘要:
题目描述: Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Input: 3 / \ 9 20 / \ 15 阅读全文
摘要:
题目描述: Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Example 2: Note: You may assume the tree (i.e., the given r 阅读全文
摘要:
题目描述: You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for 阅读全文