上一页 1 2 3 4 5 6 7 ··· 27 下一页
摘要: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: [ "((()))", "(()())", "(())()", "()(())",... 阅读全文
posted @ 2018-01-23 21:50 xiejunzhao 阅读(159) 评论(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 the matrix is Toeplitz.Example 1:Input: matrix = [[1,2,3... 阅读全文
posted @ 2018-01-22 23:26 xiejunzhao 阅读(201) 评论(0) 推荐(0)
摘要: Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231.Find the maximum result of ai XOR aj, where 0 ≤ i, j < n.Could you do this in O(n) runtime?Example:Input: [3, 10, 5, 25, 2,... 阅读全文
posted @ 2018-01-22 23:26 xiejunzhao 阅读(161) 评论(0) 推荐(0)
摘要: The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Now your job is to find the total Hamming distance between all pairs of the given... 阅读全文
posted @ 2018-01-19 23:07 xiejunzhao 阅读(152) 评论(0) 推荐(0)
摘要: You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow another pair (a, b) if and only if b [3,4] Note:T... 阅读全文
posted @ 2018-01-19 23:06 xiejunzhao 阅读(213) 评论(0) 推荐(0)
摘要: There is a room with n lights which are turned on initially and 4 buttons on the wall. After performing exactly m unknown operations towards buttons, you need to return how many different kinds of st... 阅读全文
posted @ 2018-01-19 23:05 xiejunzhao 阅读(193) 评论(0) 推荐(0)
摘要: Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially filled sudoku which... 阅读全文
posted @ 2018-01-19 23:04 xiejunzhao 阅读(170) 评论(0) 推荐(0)
摘要: Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:a) I... 阅读全文
posted @ 2018-01-17 21:36 xiejunzhao 阅读(142) 评论(0) 推荐(0)
摘要: Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.Example 1:Input: s1 = "sea", s2 = "eat" Output: 231 Explanation: Deleting "s" from "sea" adds the AS... 阅读全文
posted @ 2018-01-17 21:36 xiejunzhao 阅读(163) 评论(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 one part, and return a list of integers representing th... 阅读全文
posted @ 2018-01-15 22:41 xiejunzhao 阅读(139) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 27 下一页