摘要: 今天做了下LeetCode上面字符串倒序的题目,突然想Python中字符串倒序都有哪些方法,于是网上查了下,居然有这么多种方法: 个人觉得,第二种方法是最容易想到的,因为List中的reverse方法比较常用,做LeetCode题目7. Reverse Integer也用了这种方法,程序耗时65ms 阅读全文
posted @ 2016-10-19 13:29 PolarBearInterest 阅读(1228) 评论(0) 推荐(0) 编辑
摘要: 题目: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return 阅读全文
posted @ 2016-10-18 14:44 PolarBearInterest 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 继续学习Python中,最近看书《Python基础教程》中的虚拟茶话会项目,觉得很有意思,自己敲了一遍,受益匪浅,同时记录一下。 主要用到异步socket服务客户端和服务器模块asyncore以及异步socket命令和响应处理模块asynchat 其中asyncore模块中只有一个类dispatch 阅读全文
posted @ 2016-10-13 16:17 PolarBearInterest 阅读(509) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 f 阅读全文
posted @ 2016-10-12 13:54 PolarBearInterest 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 最近在学习python,网络编程中,python寥寥几句,就可以创建一个服务端和客户端程序: 服务端: import sockets = socket.socket()host = socket.gethostname()port = 1234s.bind((host, port))s.listen 阅读全文
posted @ 2016-10-11 18:27 PolarBearInterest 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in 阅读全文
posted @ 2016-10-09 18:09 PolarBearInterest 阅读(1180) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 hav 阅读全文
posted @ 2016-10-08 16:17 PolarBearInterest 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 最近再学习java的web编程,发现用java创建一个小的服务器和客户端是如此的简单,引用经典图书《Tomcat与Java Web开发技术详解(第二版)》(孙卫琴) 根据书中案例敲代码自己学习,放这里记录一下,以便复习:) 服务器端程序,接收客户端程序发出的HTTP请求,把它打印到控制台,然后解析 阅读全文
posted @ 2016-09-23 10:20 PolarBearInterest 阅读(2262) 评论(0) 推荐(1) 编辑
摘要: 题目: Given an array of integers, every element appears three times except for one. Find that single one. Your algorithm should have a linear runtime co 阅读全文
posted @ 2016-09-20 10:46 PolarBearInterest 阅读(144) 评论(0) 推荐(0) 编辑
摘要: A、 good and abc B、 good and gbc C、 test ok and abc D、 test ok and gbc 答案:B 解析:我也像很多人一样,上了就像选D。但敲到eclipse中试了下,的确输出B。很神奇!百度了一下,这就是所谓的java只有值传递,没有引用传递。 就 阅读全文
posted @ 2016-09-20 10:13 PolarBearInterest 阅读(167) 评论(0) 推荐(0) 编辑