05 2018 档案

摘要:题目:Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The 阅读全文
posted @ 2018-05-27 22:28 pathjh 阅读(151) 评论(0) 推荐(0)
摘要:题目:在两个排序数组中寻找第K小的数 举例: arr1=[1,2,3,4,5],arr2=[3,4,5],k=1 1是所有数中第一小的数,所以返回1 arr1=[1,2,3],arr2=[3,4,5,6],k=4 3是所有数中第4小的数,所以返回3 要求:如果arr1的长度为N,arr2的长度为M, 阅读全文
posted @ 2018-05-27 21:33 pathjh 阅读(4360) 评论(0) 推荐(1)
摘要:题目:Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. E 阅读全文
posted @ 2018-05-27 15:18 pathjh 阅读(121) 评论(0) 推荐(0)
摘要:题目:Longest Substring Without Repeating Characters Given a string, find the length of the longest substring without repeating characters. Examples: Giv 阅读全文
posted @ 2018-05-26 22:33 pathjh 阅读(158) 评论(0) 推荐(0)
摘要:题目:Add Two Numbers You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of 阅读全文
posted @ 2018-05-26 17:02 pathjh 阅读(148) 评论(0) 推荐(0)
摘要:题目描述 Implement regular expression matching with support for'.'and'*'. '.' Matches any single character. '*' Matches zero or more of the preceding elem 阅读全文
posted @ 2018-05-16 01:07 pathjh 阅读(324) 评论(0) 推荐(0)
摘要:一个简单的题,复习一下KMP 对于两个字符串A,B。请设计一个高效算法,找到B在A中第一次出现的起始位置。若B未在A中出现,则返回-1。 给定两个字符串A和B,及它们的长度lena和lenb,请返回题目所求的答案。 测试样例: 总结一下,kmp算法的核心就在于next[]数组,如果不用next[]数 阅读全文
posted @ 2018-05-07 01:04 pathjh 阅读(404) 评论(0) 推荐(0)