摘要: 描述Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.分析暴力算法的复杂度是 O(m ∗ n),代 阅读全文
posted @ 2018-06-11 23:59 昵称真难想 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 描述Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoringcases.For example,”A man, a plan, a canal: Pan 阅读全文
posted @ 2018-06-11 22:49 昵称真难想 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 描述Given an array of integers, every element appears three times except for one. Find that single one.Note: Your algorithm should have a linear runtime 阅读全文
posted @ 2018-06-11 17:33 昵称真难想 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Single Number描述Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear 阅读全文
posted @ 2018-06-11 17:04 昵称真难想 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 描述Follow up for ”Search in Rotated Sorted Array”: What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a functi 阅读全文
posted @ 2018-06-11 15:56 昵称真难想 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 描述Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target va 阅读全文
posted @ 2018-06-11 15:46 昵称真难想 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 描述Given a sorted array, remove the duplicates in place such that each element appear onlyonce and return the new length.Do not allocate extra space fo 阅读全文
posted @ 2018-06-11 15:22 昵称真难想 阅读(77) 评论(0) 推荐(0) 编辑
摘要: Remove Duplicates from Sorted Array II描述Follow up for ”Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted arra 阅读全文
posted @ 2018-06-11 15:00 昵称真难想 阅读(94) 评论(0) 推荐(0) 编辑