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 阅读全文
posted @ 2018-08-31 10:32 gszzsg 阅读(145) 评论(0) 推荐(0) 编辑
摘要:题目描述: Given a collection of distinct integers, return all possible permutations. Example: 解题思路: 用回溯法。使用额外空间记录每个数值是否已经使用。 代码: 1 class Solution { 2 publ 阅读全文
posted @ 2018-08-30 17:48 gszzsg 阅读(109) 评论(0) 推荐(0) 编辑
摘要:题目描述: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set 阅读全文
posted @ 2018-08-29 12:49 gszzsg 阅读(88) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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: 阅读全文
posted @ 2018-08-28 11:09 gszzsg 阅读(93) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 [ 阅读全文
posted @ 2018-08-27 21:11 gszzsg 阅读(89) 评论(0) 推荐(0) 编辑
摘要:题目描述: Given a binary tree, return the inorder traversal of its nodes' values. Example: 解题思路: 递归的方法。 代码: 1 /** 2 * Definition for a binary tree node. 3 阅读全文
posted @ 2018-08-27 19:34 gszzsg 阅读(113) 评论(0) 推荐(0) 编辑
摘要:题目描述: Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes 阅读全文
posted @ 2018-08-26 20:14 gszzsg 阅读(110) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-22 20:58 gszzsg 阅读(164) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-22 19:56 gszzsg 阅读(98) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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  阅读全文
posted @ 2018-08-19 20:10 gszzsg 阅读(77) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-19 10:34 gszzsg 阅读(101) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-18 14:57 gszzsg 阅读(89) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-18 14:18 gszzsg 阅读(93) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-17 20:59 gszzsg 阅读(95) 评论(0) 推荐(0) 编辑
摘要:题目描述: Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy 阅读全文
posted @ 2018-08-17 19:31 gszzsg 阅读(81) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-16 19:49 gszzsg 阅读(75) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-16 18:37 gszzsg 阅读(84) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-15 19:12 gszzsg 阅读(122) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-14 21:05 gszzsg 阅读(109) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-14 19:56 gszzsg 阅读(112) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/sharpEric/p/9473127.html 阅读全文
posted @ 2018-08-14 11:35 gszzsg 阅读(4) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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. 阅读全文
posted @ 2018-08-13 21:33 gszzsg 阅读(72) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-13 20:11 gszzsg 阅读(90) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-12 16:09 gszzsg 阅读(124) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-11 17:08 gszzsg 阅读(58) 评论(0) 推荐(0) 编辑
摘要:题目描述: Example: Note: A word is defined as a sequence of non-space characters. Input string may contain leading or trailing spaces. However, your rever 阅读全文
posted @ 2018-08-10 20:09 gszzsg 阅读(77) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-09 20:14 gszzsg 阅读(71) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-09 19:40 gszzsg 阅读(103) 评论(0) 推荐(0) 编辑
摘要:公积金可以直接异地申请办理,养老保险和医疗保险需在离职后在上海市相应部门开具相应转移文件。 具体事项见链接: https://blog.csdn.net/m0_37355951/article/details/80494617 阅读全文
posted @ 2018-08-09 10:48 gszzsg 阅读(205) 评论(0) 推荐(0) 编辑
摘要:题目描述: Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The give 阅读全文
posted @ 2018-08-08 21:04 gszzsg 阅读(89) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-08 19:28 gszzsg 阅读(96) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-07 21:47 gszzsg 阅读(126) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-07 21:17 gszzsg 阅读(115) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-06 21:43 gszzsg 阅读(121) 评论(0) 推荐(0) 编辑
摘要:题目描述: Given two strings representing two complex numbers. You need to return a string representing their multiplication. Note i2 = -1 according to the 阅读全文
posted @ 2018-08-05 10:56 gszzsg 阅读(94) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-02 21:00 gszzsg 阅读(101) 评论(0) 推荐(0) 编辑
摘要:题目描述: 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 阅读全文
posted @ 2018-08-01 18:57 gszzsg 阅读(86) 评论(0) 推荐(0) 编辑