![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
花开彼岸天x
这个作者很懒,什么都没留下…
展开
-
python 浅拷贝与深拷贝
拷贝是针对组合对象而言,原子类型的复制相当于赋值赋值"""赋值,相当于给一个引用,修改任何一方,另一方都会变化"""a = [12, 13, 'dd']b = ab[0] = 1del a[1]print a, bb.append(3)print a, b输出结果为:[1, 'dd'] [1, 'dd'][1, 'dd', 3] [1, 'dd', 3]原创 2017-08-18 15:45:55 · 217 阅读 · 0 评论 -
15. 3sum Python 实现
3sum问题描述:Given an array S of n integers, are there elements a,b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must n原创 2017-08-21 15:43:14 · 1981 阅读 · 0 评论 -
16. 3Sum Closest
16. 3Sum Closest 先排序,在左右夹逼Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume th原创 2017-08-21 15:57:52 · 245 阅读 · 0 评论 -
31. Next Permutation
31. Next Permutation 问题描述:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rea原创 2017-08-22 09:51:51 · 299 阅读 · 0 评论 -
leetcode 227. basic calculator 计算字符串表达式的值 python
227. Basic Calculator IIImplement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / operators and empty spaces原创 2017-09-06 16:46:39 · 1119 阅读 · 2 评论 -
n个正整数,联接成一排,组成一个最大(最小)的多位整数 python
n个正整数,联接成一排,组成一个最大(最小)的多位整数 python原创 2017-08-29 16:21:59 · 5177 阅读 · 2 评论 -
reverse linklist 反转链表的一部分 python
描述:Reverse a linked list from position m to n. Do it in-place and in one-pass.For example: Given 1->2->3->4->5->nullptr, m = 2 and n = 4,return 1->4->3->2->5->nullptr.Note: Given m, n satisfy原创 2017-08-31 11:02:32 · 812 阅读 · 0 评论 -
最长公共子序列 python
注意:子序列和子串的区别,前者是字符串里的不相隔的字符组成的串,字符的先后顺序不变;后者是连续的字符组成的字符串实现下面的递推式,就实现了dp动归。更多图解的过程,可以参看博客http://blog.csdn.net/hrn1216/article/details/51534607class LCS: def findLCS(self, A, n, B, m原创 2017-09-26 08:38:22 · 1957 阅读 · 1 评论 -
python cumsum函数
这个函数的功能是返回给定axis上的累计和函数的原型如下:详见 docnumpy.cumsum(a, axis=None, dtype=None, out=None) Return the cumulative sum of the elements along a given axis.官方的文档是没有详细解释,本人做了测试自己把理解的写下。1.对于一维输入a(可...原创 2017-12-19 13:46:10 · 95019 阅读 · 27 评论