08 2018 档案
摘要:题目描述: 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
阅读全文
摘要:题目描述: Given an n-ary tree, return the postorder traversal of its nodes' values. For example, given a 3-ary tree: Return its postorder traversal as: [5
阅读全文
摘要:题目描述: In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original
阅读全文
摘要:题目描述: Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appe
阅读全文
摘要:题目描述: Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the
阅读全文
摘要:题目描述: Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy
阅读全文
摘要:题目描述: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizonta
阅读全文
摘要:题目描述: A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given an M x N matrix, return True if and only if
阅读全文
摘要:题目描述: You're now a baseball game point recorder. Given a list of strings, each string can be one of the 4 following types: Each round's operation is p
阅读全文
摘要:题目描述: Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farth
阅读全文
摘要:题目描述: S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sorted in some custom order previously. We want
阅读全文
摘要:https://www.cnblogs.com/sharpEric/p/9473127.html
阅读全文
摘要:题目描述: Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.
阅读全文
摘要:题目描述: Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. Example 1
阅读全文
摘要:题目描述: We are given two sentences A and B. (A sentence is a string of space separated words. Each word consists only of lowercase letters.) A word is u
阅读全文
摘要:题目描述: Write a function that takes a string as input and returns the string reversed. Example 1: Input: "hello" Output: "olleh" Example 2: Input: "A ma
阅读全文
摘要:题目描述: Example: Note: A word is defined as a sequence of non-space characters. Input string may contain leading or trailing spaces. However, your rever
阅读全文
摘要:题目描述: Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word or
阅读全文
摘要:题目描述: A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetco
阅读全文
摘要:公积金可以直接异地申请办理,养老保险和医疗保险需在离职后在上海市相应部门开具相应转移文件。 具体事项见链接: https://blog.csdn.net/m0_37355951/article/details/80494617
阅读全文
摘要:题目描述: Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The give
阅读全文
摘要:题目描述: We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter w
阅读全文
摘要:题目描述: Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You m
阅读全文
摘要:题目描述: Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second
阅读全文
摘要:题目描述: Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. For example, in the g
阅读全文
摘要:题目描述: Given two strings representing two complex numbers. You need to return a string representing their multiplication. Note i2 = -1 according to the
阅读全文
摘要:题目描述: A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most
阅读全文
摘要:题目描述: Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and colu
阅读全文