LeetCode-Array/String
文章平均质量分 53
BaibuT
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
String to Integer(atoi)
8. String to Integer (atoi) 题目的原意是 实现atoi 的方法来将String转换成数值。 方法的基本要求: 先去除第一个字母前的空格,然后判断第一个字母看是否是+,-,数字。如果是+给个+符号并且将光标移到下一个字母,如果是-, 给个-符号并且将光标移到下一个字母。 如果是数字,需要将数字的Strng格式的部分转换成数值。 例子: Input: "42" O...原创 2016-01-05 05:03:57 · 502 阅读 · 0 评论 -
II Hash Table: 2. Longest Substring Without Repeating Characters
3. Longest Substring Without Repeating Characters given: 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 · 350 阅读 · 0 评论 -
II Hash Table: Valid Anagram
1. Valid Anagram given: 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 · 414 阅读 · 0 评论 -
Product of Array Except Self
238. Product of Array Except Self given: 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 · 334 阅读 · 0 评论 -
Container With Most Water
11. Container With Most Water given: 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 · 370 阅读 · 0 评论 -
Valid Palindrome
125. Valid Palindrome given: 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 · 387 阅读 · 0 评论 -
Rotate Array
189. Rotate Array requirement: 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 · 556 阅读 · 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 · 414 阅读 · 0 评论 -
Two Sum II - Input array is sorted
167. Two Sum II - Input array is sorted Given: 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 · 422 阅读 · 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 length requirment: do not allocate extra space for another array, you m原创 2015-12-29 21:52:16 · 367 阅读 · 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 · 416 阅读 · 0 评论 -
One Edit Distance
161. One Edit Distance 题目的原意: 写一个函数判断两个给定的String是否是编辑距离为一。 给定条件:两个字符串。 解题思路:用one edit的算法会超时,可以利用只有一个编辑的距离的特点。将问题细分为出现一个距离的一下几种情况。 1. 两个字符串长度一样的时候,说明只有一个字符串不一样,所以只需要看对应位置的连个字符是否一致,是否只...原创 2018-08-31 20:22:26 · 402 阅读 · 0 评论
分享