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

2014年(53)

我的朋友

发布时间:2014-09-18 09:42:39

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a palindrome.Note:Have you consider that the string might be empty? This is a.........【阅读全文】

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

发布时间:2014-09-16 16:19:17

我们先研究一下这个问题,判断一个字符串s3是否由给定的字符串s1和s2交错而成:由于s1和s2中可能有相同的字符,所以无法通过遍历s3得出结论。那看一下是否有最优子结构?也就是说,问题的解是否可以由子问题的解推导出来。假设s3的长度为l3,首先想到的是result[l3]=result[l3-1]&&(s3[l3-1]在s1或s2中);后.........【阅读全文】

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

发布时间:2014-09-06 13:50:01

A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total number of ways to decode it.For example,Given encoded message "12", it could be dec.........【阅读全文】

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

发布时间:2014-09-05 22:26:10

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [6,5,7], [4,1,8,3]]The minimum path sum from top to bottom is 11 (i.e., 2&n.........【阅读全文】

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

发布时间:2014-09-04 22:11:36

题目一:设两个有序数组的长度均为n,求它们组成的2n长的数组的中位数。假设n为奇数,那么n/2是每个数组中位数的下标,假设1. A[n/2]>B[n/2],那么A[n/2+1]...A[n-1]都大于A[0]...A[n/2]并且大于B[0]...B[n/2],而这些数加起来有n+1个,所以A[n/2+1]...A[n-1]大于所求的中位数;同理,B[0]...B[n/2-1]小于B[n/2]...B[n-.........【阅读全文】

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

登录 注册