咖灰怪’s Blog

LeetCode刷题之5:Longest Substring Without Repeating Characters(3)

2018-02-07 14:42:19    学习笔记数据结构和算法   451 阅读   0条回复

1. 题目1.1 英文Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the length is 3. Given "bbbbb", the answer is "b", with the length of 1. Given "pwwkew", the answer is "wke&quo...

LeetCode刷题之4:Valid Parentheses(20)

2018-02-06 14:42:19    学习笔记数据结构和算法   367 阅读   0条回复

1. 题目1.1 英文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 valid but "(]" and "([)]" are no...

LeetCode刷题之3:Palindrome Number(9)

2018-02-01 17:01:37    学习笔记数据结构和算法   278 阅读   0条回复

1. 题目1.1 英文Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to string, note the restriction of using extra space.You could also try reversing an integer. However, if you have solved the p...

LeetCode刷题之2:Reverse Integer(7)

2018-01-25 15:41:53    学习笔记数据结构和算法   308 阅读   0条回复

1. 题目Given a 32-bit signed integer, reverse digits of an integer. Example 1:Input: 123Output: 321 Example 2:Input: -123Output: -321 Example 3:Input: 120Output: 21 Note:Assume we are dealing with an environment which could only hold integers within the 32-bit signed integer range. For the purpose of this problem, assume...

LeetCode刷题之1:Two Sum(1)

2018-01-24 14:17:34    学习笔记数据结构和算法   212 阅读   0条回复

准备定期刷一刷LeetCode上的题目,并且做一做笔记,这是第一篇。算法实现将采用Go语言。 1. 题目Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums...


2018-01-23 14:43:04    学习笔记数据结构和算法   462 阅读   0条回复

这是一篇数据结构的学习笔记,记录一下一些常见数据结构的概念。 1. 什么是数据结构数据结构是以某种形式将数据组织在一起的集合,它不仅存储数据,还支持访问和处理数据的操作。即:数据结构 = 数据存储 + 数据操作 2. 什么是算法数据结构是数据存储的方式,而算法就是处理数据的方法,数据结构是数据存储的方式,而算法就是处理数据的方法。 3. 时...


2016-10-12 23:42:56    PHP数据结构和算法   365 阅读   0条回复

因为之前没有编程基础,最近才知道排序算法这个概念,原来平时在操作数组的时候是用到“算法”这玩意的。 从网上找了下资料,都一个来源;用$arr=array(1,43,54,62,21,66,32,78,36,76,39); 做例子排序。 1. 冒泡排序1.1 原理在要排序的一组数中,对当前还未排好的序列,从前往后对相邻的两个数依次进行比较和调整,让较大的数往下沉,较小的往上冒。即...