Chinaunix首页 | 论坛 | 博客
  • 博客访问: 117168
  • 博文数量: 53
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 620
  • 用 户 组: 普通用户
  • 注册时间: 2014-08-24 16:22
文章存档

2014年(53)

我的朋友

发布时间:2014-10-07 15:06:53

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.首先我用了DP,没想到存储没报错,时间报错了,TLE了。原理是记录所有回文,然后更新最大值。比较值得注意.........【阅读全文】

阅读(881) | 评论(0) | 转发(0)

发布时间:2014-10-07 14:55:35

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", which has length = 2..........【阅读全文】

阅读(999) | 评论(0) | 转发(0)

发布时间:2014-10-07 14:38:42

Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BANC"..........【阅读全文】

阅读(896) | 评论(0) | 转发(0)

发布时间:2014-10-07 14:29:36

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:.........【阅读全文】

阅读(780) | 评论(0) | 转发(0)

发布时间:2014-10-07 14:23:17

Divide two integers without using multiplication, division and mod operator.整数的除法,但无法用乘号,除号和余号。可以考虑二分,假设A/B, 则解空间在[0, A]当B*A/2<A时,表明解在[A/2,A]之间==>注意这里A/2可能是解,因为整数的除法是舍去余数的当B*A/2>A时,表明解在[0, A/2)之间,当B*A/2==A时,表明解.........【阅读全文】

阅读(833) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册