上一页 1 2 3 4 5 6 ··· 18 下一页
摘要: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at 阅读全文
posted @ 2016-08-29 05:04 fenshen371 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list 阅读全文
posted @ 2016-08-28 13:27 fenshen371 阅读(182) 评论(0) 推荐(0) 编辑
摘要: Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. 阅读全文
posted @ 2016-08-28 07:10 fenshen371 阅读(176) 评论(0) 推荐(0) 编辑
摘要: Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[i] + 阅读全文
posted @ 2016-08-28 06:40 fenshen371 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative number represented as a singly linked list of digits, plus one to the number. The digits are stored such that the most significan 阅读全文
posted @ 2016-08-27 13:03 fenshen371 阅读(121) 评论(0) 推荐(0) 编辑
摘要: One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, 阅读全文
posted @ 2016-08-27 12:55 fenshen371 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled 阅读全文
posted @ 2016-08-27 09:35 fenshen371 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or 阅读全文
posted @ 2016-08-27 09:08 fenshen371 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Implement pow(x, n). 思路:n为0时返回1。 之后我们只考虑n为正的情况(n为负时结果为正时的倒数)。之后我们通过二分法来求值。 假如n为偶数,则pow(x, n) = pow(x, n / 2) * pow(x, n / 2)。 假如n为奇数,则pow(x, n) = pow( 阅读全文
posted @ 2016-08-26 06:59 fenshen371 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Suppose we abstract our file system by a string in the following manner: The string "dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext" represents: The director 阅读全文
posted @ 2016-08-26 06:20 fenshen371 阅读(300) 评论(2) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 18 下一页