![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode-Array/String
文章平均质量分 59
BaibuT
这个作者很懒,什么都没留下…
展开
-
String to Integer(atoi)
8. String to Integer (atoi)题目的原意是 实现atoi 的方法来将String转换成数值。方法的基本要求: 先去除第一个字母前的空格,然后判断第一个字母看是否是+,-,数字。如果是+给个+符号并且将光标移到下一个字母,如果是-, 给个-符号并且将光标移到下一个字母。 如果是数字,需要将数字的Strng格式的部分转换成数值。例子:Input: "42" O...原创 2016-01-05 05:03:57 · 435 阅读 · 0 评论 -
II Hash Table: 2. Longest Substring Without Repeating Characters
3. Longest Substring Without Repeating Charactersgiven: a string, find the length of the longest substring without repeating characters. e.g. the longest substring without repeating letters原创 2016-01-03 00:21:08 · 296 阅读 · 0 评论 -
II Hash Table: Valid Anagram
1. Valid Anagramgiven: two strings s and t, write a function to determine if t is an anagram of s.e.g.s="anagram", t="nagaram", return true.s="rat", t="car", return false.strategy: u原创 2016-01-02 23:55:14 · 357 阅读 · 0 评论 -
Product of Array Except Self
238. Product of Array Except Selfgiven: an array of n integers where n>1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].原创 2016-01-02 21:51:00 · 281 阅读 · 0 评论 -
Container With Most Water
11. Container With Most Watergiven: n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of li原创 2016-01-02 20:55:25 · 321 阅读 · 0 评论 -
Valid Palindrome
125. Valid Palindromegiven: a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.e.g. "A man, a plan, a canal: Panama" is a palindrome."race a原创 2016-01-02 17:37:17 · 326 阅读 · 0 评论 -
Rotate Array
189. Rotate Arrayrequirement: rotate an array of n elements to the right by k steps.for example, with n=7 and k=3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]note: try to come up原创 2015-12-30 04:14:56 · 502 阅读 · 0 评论 -
Reverse Words in a String II
186. Reverse Words in a String II题目的原意是用就地操作来实现函数对给定的char string 进行逐个单词的反转。存在的挑战: 1. 在不使用split的方法的情况下实现。 2. 旋转array从左到右就地操作,而且不申请额外的空间。 解题思路1: 1. 先反转整个string。2. 再反转单个词。3. 这样需要写一个swap方法来置换...原创 2015-12-30 03:17:33 · 364 阅读 · 0 评论 -
Two Sum II - Input array is sorted
167. Two Sum II - Input array is sortedGiven: an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.output: the原创 2015-12-30 00:32:17 · 367 阅读 · 0 评论 -
remove duplicates from sorted Array
Given: a sorted array, to do: remove the duplicates in place such that each element appear only once and return the new lengthrequirment: do not allocate extra space for another array, you m原创 2015-12-29 21:52:16 · 318 阅读 · 0 评论 -
two sum
question:Given: an array of integers, to do: find two numbers such that they add up to a specific target number.requirement: The function twoSum should return indices of the two numbers原创 2015-12-28 01:51:57 · 294 阅读 · 0 评论 -
One Edit Distance
161. One Edit Distance题目的原意: 写一个函数判断两个给定的String是否是编辑距离为一。给定条件:两个字符串。解题思路:用one edit的算法会超时,可以利用只有一个编辑的距离的特点。将问题细分为出现一个距离的一下几种情况。 1. 两个字符串长度一样的时候,说明只有一个字符串不一样,所以只需要看对应位置的连个字符是否一致,是否只...原创 2018-08-31 20:22:26 · 314 阅读 · 0 评论