- 博客(32)
- 收藏
- 关注
原创 LeetCode - 136. 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 runtime complexity. Could you implement it without usin
2017-03-02 19:53:24
275
原创 LeetCode - 242. Valid Anagram
题目:Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You ma
2017-03-02 15:55:46
460
原创 leetCode - 496. Next Greater Element I
题目:You are given two arrays (without duplicates) nums1 andnums2 where nums1’s elements are subset of nums2. Find all the next greater numbers fornums1's elements in the corresponding places of
2017-02-28 11:52:50
488
原创 LeetCode - 350. Intersection of Two Arrays II
题目:Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return[2, 2].Note:Each element in the result should appear as
2017-02-27 21:32:43
357
原创 LeetCode - 349. Intersection of Two Arrays
题目:Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return[2].Note:Each element in the result must be unique.The r
2017-02-27 21:10:52
275
原创 LeetCode - 35. Search Insert Position
题目:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the a
2017-02-24 17:30:18
268
原创 LeetCode - 66. Plus One
题目:Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The dig
2017-02-24 14:53:37
355
原创 LeeyCode - 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.The function twoSum should return indices of the two n
2017-02-23 13:56:33
373
原创 LeetCode - 268. Missing Number
题目:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.思路与步骤:思路1:先排序,然后将数组与下标比较,第一次出现不相等的下标即确实数据。学习别人的思路:思路2:先对0到
2017-02-22 22:51:25
240
原创 LeetCode - 189. Rotate Array
题目: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 as many solutions as
2017-02-22 17:52:27
245
原创 LeetCode - 141. Linked List Cycle
题目:Given a linked list, determine if it has a cycle in it.思路与步骤:采用“快慢指针”查检查链表是否含有环。让一个指针一次走一步,另一个一次走两步,如果链表中含有环,快指针会再次和慢指针相遇。编程实现:/** * Definition for singly-linked list. * class
2017-02-22 12:44:04
243
原创 leetCode - 459. Repeated Substring Pattern
题目:Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase
2017-02-21 20:40:46
358
原创 LeetCode - 520. Detect Capital
题目:Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters
2017-02-21 17:56:23
379
原创 LeetCode - 434. Number of Segments in a String
题目:Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.Please note that the string does not contain any non-printable charact
2017-02-21 12:55:28
387
原创 LeetCode - 125. Valid Palindrome
题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.思路与步骤:首先理解题目要求:通过测试样例得知,输入的字符串只比较大小写字母和0-9,其中同一个字母的大小写认为一样,其他字忽略。于是有两种思路思路1:
2017-02-20 22:13:56
383
原创 LeetCode - 67. Add Binary
题目:Given two binary strings, return their sum (also a binary string).思路与步骤:原思路:将两个string逐个字符相加,设置一个flag ,进位的话记 flag=1,反之 flag=0需要处理的一些细节:1. a 和 b 的 0, 1 是字符形式,要写成 '0', '1';flag 是 int 型
2017-02-20 13:23:21
246
原创 LeetCode - 28. Implement strStr()
题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.思路与步骤:两个字符串逐个字符比较,如果两个字符串第一个不同,则大的下标加1,小的不变,依次循环;如果相同,则依次逐个比较
2017-02-19 22:19:55
261
原创 LeetCode - 20. Valid Parentheses
题目:Given a string containing just the characters '(', ')','{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all
2017-02-19 20:07:28
238
原创 LeetCode - 13. Roman to Integer
题目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.思路与步骤:分两步进行,先对应,再计算。基本思路是: 首先将 roman 基本字符与阿拉伯数字对应起来,存在一个结构中,然后对输入的字符串逐个字
2017-02-19 15:24:04
413
原创 LeetCode - 383. Ransom Note
题目:Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magaz
2017-02-16 22:24:38
350
原创 LeetCode - 345. Reverse Vowels of a String
题目:Write a function that takes a string as input and reverse only the vowels of a string.思路与步骤:1. 找出源字符串中的元音字母;2. 为了只遍历一次,需要每次都找出当前的第一个和最后一个元音字母,并进行交换。步骤:1. 写一个方法来判断是否是元音字母;2. 当字符串为空
2017-02-03 23:14:10
334
原创 Leetcode - 8.String to Integer (atoi)
题目:Implement atoi to convert a string to an integer. 思路与步骤:1. 判断字符串是否为控字符串;2. 去掉开头的空格;3. 判断开始位是否有正负;4. 转换,同时注意overflow的问题。 核心步骤: String逐个字符从左往右遍历,若为数字,则 result = String当前位的int值;
2017-01-26 15:24:26
248
转载 分布式基础学习【二】 —— 分布式计算系统(Map/Reduce)
转自 http://blog.youkuaiyun.com/heyutao007/article/details/5468395 二. 分布式计算(Map/Reduce)分布式式计算,同样是一个宽泛的概念,在这里,它狭义的指代,按GoogleMap/Reduce框架所设计的分布式框架。在Hadoop中,分布式文件系统,很大程度上,是为各种分布式计算需求所服务的。我们说分布式文件系统
2015-12-22 01:05:22
484
转载 分布式基础学习【一】 —— 分布式文件系统
转自 http://blog.youkuaiyun.com/heyutao007/article/details/5468390 所谓分布式,在这里,很狭义的指代以Google的三驾马车,GFS、Map/Reduce、BigTable为框架核心的分布式存储和计算系统。通常如我一样初学的人,会以Google这几份经典的论文作为开端的。它们勾勒出了分布式存储和计算的一个基本蓝图
2015-12-21 23:13:17
628
转载 Linux系统文件系统的结构层次详解
转自 http://soft.chinabyte.com/os/142/12315142.shtmlLinux系统文件系统的结构层次详解发布时间:2012-04-20 00:00:00 来源:中国IT实验室 作者:佚名关键字:Linux Linux文件系统的整体结构模型大概可以划分为以下层次: Hard Disk => Disk Driv
2015-12-21 16:57:33
985
1
转载 Linux文件系统
转自 http://man.chinaunix.net/tech/lyceum/linuxK/fs/filesystem.html第九章 文件系统本章主要描叙Linux核心对文件系统的支持, 虚拟文件系统(VFS)以及Linux核心对实际文件系统的支持。 Linux的最重要特征之一就是支持多种文件系统。这样它更加灵活并可以和许多其它种操作系统共存。在本文写作时Lin
2015-12-21 16:04:47
439
原创 LeetCode - 14. Longest Common Prefix
题目:Write a function to find the longest common prefix string amongst an array of strings.
2015-12-20 22:01:22
574
原创 LeetCode - 6. ZigZag Conversion
题目:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P
2015-12-11 16:22:44
556
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人