10 2016 档案
摘要:今天做了下LeetCode上面字符串倒序的题目,突然想Python中字符串倒序都有哪些方法,于是网上查了下,居然有这么多种方法: 个人觉得,第二种方法是最容易想到的,因为List中的reverse方法比较常用,做LeetCode题目7. Reverse Integer也用了这种方法,程序耗时65ms
阅读全文
摘要:题目: 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
阅读全文
摘要:继续学习Python中,最近看书《Python基础教程》中的虚拟茶话会项目,觉得很有意思,自己敲了一遍,受益匪浅,同时记录一下。 主要用到异步socket服务客户端和服务器模块asyncore以及异步socket命令和响应处理模块asynchat 其中asyncore模块中只有一个类dispatch
阅读全文
摘要:题目: 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
阅读全文
摘要:最近在学习python,网络编程中,python寥寥几句,就可以创建一个服务端和客户端程序: 服务端: import sockets = socket.socket()host = socket.gethostname()port = 1234s.bind((host, port))s.listen
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: 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
阅读全文