随笔分类 -  RP

上一页 1 ··· 3 4 5 6 7
摘要:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. 阅读全文
posted @ 2016-07-04 10:30 北叶青藤 阅读(216) 评论(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, 阅读全文
posted @ 2016-07-04 05:29 北叶青藤 阅读(242) 评论(0) 推荐(0)
摘要:Sort a linked list in O(n log n) time using constant space complexity. Example Given 1->3->2->null, sort it to 1->2->3->null. Merge Sort version 1 /** 阅读全文
posted @ 2016-07-03 10:24 北叶青藤 阅读(185) 评论(0) 推荐(0)
摘要:Given a linked list, remove the nth node from the end of list and return its head. Notice The minimum number of nodes in list is n. Example Given link 阅读全文
posted @ 2016-07-03 02:34 北叶青藤 阅读(156) 评论(0) 推荐(0)
摘要:Given an integers array A. Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B WITHOUT divide operation. Example For A = [1, 2, 3], 阅读全文
posted @ 2016-07-01 11:05 北叶青藤 阅读(373) 评论(0) 推荐(0)
摘要:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist 阅读全文
posted @ 2016-06-30 12:11 北叶青藤 阅读(283) 评论(0) 推荐(0)
摘要:Majority Number Given an array of integers, the majority number is the number that occurs more than half of the size of the array. Find it. Example Gi 阅读全文
posted @ 2016-06-29 22:58 北叶青藤 阅读(395) 评论(0) 推荐(0)
摘要:Given an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given number target. If the arra 阅读全文
posted @ 2016-06-29 10:57 北叶青藤 阅读(522) 评论(0) 推荐(0)
摘要:Word Search I Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell 阅读全文
posted @ 2016-06-29 03:13 北叶青藤 阅读(313) 评论(0) 推荐(0)
摘要:问题: 给你一个字符串,里面只包含"(",")","[","]"四种符号,请问你需要至少添加多少个括号才能使这些括号匹配起来。如:[]是匹配的,所需括号个数为 0.([])[]是匹配的, 所需括号个数为 0.((]是不匹配的, 所需最少括号个数为 3.([)]是不匹配的,所需最少括号个数为 2. 分 阅读全文
posted @ 2015-06-25 05:26 北叶青藤 阅读(1167) 评论(0) 推荐(0)
摘要:Word Break I Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionar 阅读全文
posted @ 2015-01-26 05:49 北叶青藤 阅读(249) 评论(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 is: " 阅读全文
posted @ 2015-01-02 07:16 北叶青藤 阅读(191) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7