02 2018 档案

摘要:Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree.Example :Input: root = [4,2,6,1,3,null,null] Output: 1... 阅读全文
posted @ 2018-02-12 23:11 xiejunzhao 阅读(454) 评论(0) 推荐(0)
摘要:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example:I... 阅读全文
posted @ 2018-02-12 23:09 xiejunzhao 阅读(119) 评论(0) 推荐(0)
摘要:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.1234567891011121314151617181920212223242526class Solution: def intToRoman(self, num): ... 阅读全文
posted @ 2018-02-12 23:08 xiejunzhao 阅读(185) 评论(0) 推荐(0)
摘要:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", with ... 阅读全文
posted @ 2018-02-12 23:06 xiejunzhao 阅读(219) 评论(0) 推荐(0)
摘要:Given a list of 24-hour clock time points in "Hour:Minutes" format, find the minimum minutes difference between any two time points in the list.Example 1:Input: ["23:59","00:00"] Output: 1 Note:The nu... 阅读全文
posted @ 2018-02-12 23:03 xiejunzhao 阅读(221) 评论(0) 推荐(0)
摘要:Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2.Note:The length of both num1 and num2 is < 110.Both num1 and num2 contains only digits 0-9.Bot... 阅读全文
posted @ 2018-02-12 22:58 xiejunzhao 阅读(172) 评论(0) 推荐(0)
摘要:You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return i... 阅读全文
posted @ 2018-02-12 22:56 xiejunzhao 阅读(204) 评论(0) 推荐(0)
摘要:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i... 阅读全文
posted @ 2018-02-12 22:55 xiejunzhao 阅读(144) 评论(0) 推荐(0)
摘要:Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final result should be irreducible fraction. If your fin... 阅读全文
posted @ 2018-02-12 22:53 xiejunzhao 阅读(198) 评论(0) 推荐(0)
摘要:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n.Example: Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, excludi... 阅读全文
posted @ 2018-02-12 22:35 xiejunzhao 阅读(250) 评论(0) 推荐(0)
摘要:There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. You want to draw a vertical line from the top to t... 阅读全文
posted @ 2018-02-05 23:21 xiejunzhao 阅读(191) 评论(0) 推荐(0)
摘要:Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image. Example:Input: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] Ou... 阅读全文
posted @ 2018-02-05 23:19 xiejunzhao 阅读(485) 评论(0) 推荐(0)
摘要:Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3 return [1,2,3]. Note: Recursive solution is trivial, ... 阅读全文
posted @ 2018-02-05 23:18 xiejunzhao 阅读(225) 评论(0) 推荐(0)
摘要:Given a collection of distinct numbers, return all possible permutations. For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ] cla... 阅读全文
posted @ 2018-02-05 23:17 xiejunzhao 阅读(143) 评论(0) 推荐(0)
摘要:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution. A sudoku puzzle......and... 阅读全文
posted @ 2018-02-01 23:28 xiejunzhao 阅读(166) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with value v at the given depth d. The root node is at depth 1.The adding rule is: given a positive integer de... 阅读全文
posted @ 2018-02-01 23:27 xiejunzhao 阅读(153) 评论(0) 推荐(0)