技巧题型
文章平均质量分 78
iyangdi
这个作者很懒,什么都没留下…
展开
-
Google算法题:132模式
题目Given a sequence of n integers a1, a2, ..., an, a 132pattern is a subsequence ai, aj, ak such that i j kand ai ak aj. Design an algorithm that takes a list of n numbers as input and原创 2017-08-18 15:00:17 · 1637 阅读 · 1 评论 -
LeetCode:M-5. Longest Palindromic Substring
LeetCode链接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原创 2017-09-10 22:42:05 · 199 阅读 · 0 评论 -
LeetCode:M-560. Subarray Sum Equals K
LeetCode链接Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.Example 1:Input:nums = [1,1,1], k = 2Output: 2原创 2017-09-10 10:48:47 · 273 阅读 · 0 评论 -
LintCode:M-丢失的第一个正整数
LintCode链接给出一个无序的正数数组,找出其中没有出现的最小正整数。您在真实的面试中是否遇到过这个题? Yes样例如果给出 [1,2,0], return 3如果给出 [3,4,-1,1], return 2挑战 只允许时间复杂度O(n)的算法,并且只能使用常数级别的空间。pu原创 2017-08-31 17:26:22 · 287 阅读 · 0 评论 -
LintCode:M-两个整数相除
LintCode链接将两个整数相除,要求不使用乘法、除法和 mod 运算符。如果溢出,返回 2147483647 。您在真实的面试中是否遇到过这个题? Yes样例给定被除数 = 100 ,除数 = 9,返回 11。标签 二分法public class Solution { /*原创 2017-08-31 16:25:59 · 304 阅读 · 0 评论 -
LintCode:M-落单的数II
LintCode链接给出3*n + 1 个的数字,除其中一个数字之外其他每个数字均出现三次,找到这个数字。您在真实的面试中是否遇到过这个题? Yes样例给出 [1,1,2,3,3,3,2,2,4,1] ,返回 4public class Solution { /** * @param A : An int原创 2017-08-31 15:33:53 · 245 阅读 · 0 评论 -
LintCode:M-最大数
LintCode链接给出一组非负整数,重新排列他们的顺序把他们组成一个最大的整数。 注意事项最后的结果可能很大,所以我们返回一个字符串来代替这个整数。您在真实的面试中是否遇到过这个题? Yes样例给出 [1, 20, 23, 4, 8],返回组合最大的整数应为8423201。publ原创 2017-08-31 15:11:35 · 520 阅读 · 0 评论 -
LintCode:M-大数相乘
LintCode链接Given two non-negative integers num1 and num2represented as strings, return the product of num1 and num2您在真实的面试中是否遇到过这个题? Yes样例The length of both num1 and原创 2017-08-30 17:04:33 · 216 阅读 · 0 评论 -
LintCode:M-最小子串覆盖
给定一个字符串source和一个目标字符串target,在字符串source中找到包括所有目标字符串字母的子串。 注意事项如果在source中没有这样的子串,返回"",如果有多个这样的子串,返回起始位置最小的子串。您在真实的面试中是否遇到过这个题? Yes说明在答案的子串中的字母在目标字符串中是否需要具有相同的顺序?原创 2017-08-28 20:41:31 · 857 阅读 · 0 评论 -
LintCode:M-乘积最大子序列
LintCode:链接找出一个序列中乘积最大的连续子序列(至少包含一个数)。您在真实的面试中是否遇到过这个题? Yes样例比如, 序列 [2,3,-2,4] 中乘积最大的子序列为 [2,3] ,其乘积为6。分析当全部为正数的时候,乘积肯定为最大,但是由于有负数出现,只有偶数情况的负数才能转正所以前面乘积原创 2017-08-28 13:52:37 · 240 阅读 · 0 评论 -
LeetCode:M-36. Valid Sudoku
LinkDetermine 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 p原创 2017-09-05 22:01:30 · 256 阅读 · 0 评论 -
Google算法题:M-寻找缺失的数
http://www.jiuzhang.com/article/Google%202016%E5%B9%B412%E6%9C%88%20SDE%20Onsite%E9%9D%A2%E7%BB%8F/http://www.lintcode.com/zh-cn/problem/find-the-missing-number/http://www.jiuzhang.com/sol原创 2017-08-22 09:42:54 · 306 阅读 · 0 评论 -
LeetCode:M-19. Remove Nth Node From End of List
LeetCode链接Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second no原创 2017-09-10 21:05:47 · 211 阅读 · 0 评论