
python
激荡数十年
17年专职软件研发,喜欢使用的语言有:python, c, java, go
展开
-
用腾讯股票数据源更新qlib日K数据
def remote_source_tencent(symbol: str, interval: str, start_datetime: pd.Timestamp, end_datetime: pd.Timestamp): qtype = "day" if "d" in interval else interval interval = "day" if "d" in interval else interval codes = symbol.split(".",1) ..原创 2021-09-28 01:32:54 · 593 阅读 · 0 评论 -
DFS 求解金字塔10*10等腰直角三角形摆放
# -*- coding:utf8 -*-shape={ 0:[(0,0),(1,0),(1,1),(1,2)], 1:[(0,0),(0,1),(1,0),(1,1),(1,2)], 2:[(0,0),(1,0),(1,1),(1,2),(1,3)], 3:[(0,1),(1,0),(1,1),(1,2),(1,3)], ...原创 2019-09-07 00:59:07 · 286 阅读 · 0 评论 -
python写算法题:leetcode: 5. Longest Palindromic Substring
https://leetcode.com/problems/longest-palindromic-substring/#/descriptionclass Solution(object): def palindrome(self, s, centpos): ind0=0 while True: if centpos-ind原创 2017-06-02 08:52:47 · 336 阅读 · 0 评论 -
python写算法题:leetcode: 23. Merge k Sorted Lists
https://leetcode.com/problems/merge-k-sorted-lists/#/descriptionclass Solution(object): def mergeKLists(self, lists): """ :type lists: List[ListNode] :rtype: ListNode原创 2017-06-18 23:33:26 · 611 阅读 · 0 评论 -
python写算法题:leetcode: 24. Swap Nodes in Pairs
https://leetcode.com/problems/swap-nodes-in-pairs/#/description# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.nex原创 2017-06-19 00:10:23 · 237 阅读 · 0 评论 -
python写算法题:leetcode: 25. Reverse Nodes in k-Group
https://leetcode.com/problems/reverse-nodes-in-k-group/#/descriptionclass Solution(object): def reverseNode(self, nodes, k): for ind in xrange(k): node = nodes原创 2017-06-29 21:29:51 · 297 阅读 · 0 评论 -
python写算法题:leetcode: 26. Remove Duplicates from Sorted Array
https://leetcode.com/problems/remove-duplicates-from-sorted-array/#/descriptionclass Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtyp原创 2017-06-29 21:49:12 · 219 阅读 · 0 评论 -
python写算法题:leetcode: 27. Remove Element
https://leetcode.com/problems/remove-element/#/descriptionclass Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :原创 2017-06-29 21:51:45 · 276 阅读 · 0 评论 -
python写算法题:leetcode: 6. ZigZag Conversion
https://leetcode.com/submissions/detail/75938758/class Solution(object): def convert(self, s, numRows): """ :type s: str :type numRows: int :rtype: str原创 2017-06-11 02:04:36 · 437 阅读 · 0 评论 -
python写算法题:leetcode: 7. Reverse Integer
https://leetcode.com/problems/reverse-integer/#/descriptionclass Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ sign=x<0原创 2017-06-11 02:15:20 · 397 阅读 · 0 评论 -
python写算法题:leetcode: 8. String to Integer (atoi)
https://leetcode.com/problems/string-to-integer-atoi/#/descriptionclass Solution(object): def myAtoi(self, str): """ :type str: str :rtype: int """原创 2017-06-11 02:17:26 · 372 阅读 · 0 评论 -
python写算法题:leetcode: 9. Palindrome Number
class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x<0: return False base=1 while x>=base*10:原创 2017-06-11 22:28:39 · 585 阅读 · 0 评论 -
python写算法题:leetcode: 10. Regular Expression Matching
https://leetcode.com/problems/regular-expression-matching/#/descriptionclass Solution(object): def isMatch(self, s, p): """ :type s: str :type p: str :rtype: bo原创 2017-06-12 12:40:16 · 400 阅读 · 0 评论 -
python写算法题:leetcode: 12. Integer to Roman
https://leetcode.com/problems/integer-to-roman/#/descriptionclass Solution(object): def intToRoman(self, num): """ :type num: int :rtype: str """原创 2017-06-12 15:50:49 · 382 阅读 · 0 评论 -
python写算法题:leetcode: 11. Container With Most Water
https://leetcode.com/problems/container-with-most-water/#/descriptionclass Solution(object): def maxArea(self, height): """ :type height: List[int] :rtype: int原创 2017-06-12 12:44:51 · 371 阅读 · 0 评论 -
python写算法题:leetcode: 30. Substring with Concatenation of All Words
https://leetcode.com/problems/substring-with-concatenation-of-all-words/#/descriptionclass Solution(object): def matchstr(self, p0, p1, wordsind, wlen, posmap): wv={} for w in原创 2017-07-12 19:55:14 · 300 阅读 · 0 评论 -
python写算法题:leetcode: 13. Roman to Integer
https://leetcode.com/problems/roman-to-integer/#/descriptionclass Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ romanMap =原创 2017-06-12 17:26:34 · 520 阅读 · 0 评论 -
python写算法题:leetcode: 14. Longest Common Prefix
https://leetcode.com/problems/longest-common-prefix/#/descriptionclass Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str原创 2017-06-12 17:54:56 · 416 阅读 · 0 评论 -
python写算法题:leetcode: 15. 3Sum
https://leetcode.com/problems/3sum/#/descriptionclass Solution(object): def match(self, nums, ind0): ind1=ind0+1 ind2=len(nums)-1 res=[] while ind1ind1:原创 2017-06-12 23:02:44 · 328 阅读 · 0 评论 -
python写算法题:leetcode: 16. 3Sum Closest
https://leetcode.com/problems/3sum-closest/#/descriptionclass Solution(object): def match(self, nums, ind0, target, res): ind1=ind0+1 ind2=len(nums)-1 minv=abs(target-r原创 2017-06-13 01:19:12 · 251 阅读 · 0 评论 -
python写算法题:leetcode: 17. Letter Combinations of a Phone Number
https://leetcode.com/problems/letter-combinations-of-a-phone-number/#/descriptionclass Solution(object): def letterCombinations(self, digits): """ :type digits: str :rt原创 2017-06-13 01:45:12 · 296 阅读 · 0 评论 -
python写算法题:leetcode: 18. 4Sum
https://leetcode.com/problems/4sum/#/descriptionclass Solution(object): def twoSum(self, nums, target, v): ind=0 ind2=len(nums)-1 res=[] while ind<ind2:原创 2017-06-13 02:11:31 · 404 阅读 · 0 评论 -
python写算法题:leetcode: 19. Remove Nth Node From End of List
https://leetcode.com/problems/remove-nth-node-from-end-of-list/#/description# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x#原创 2017-06-13 02:35:14 · 347 阅读 · 0 评论 -
python写算法题:leetcode: 31. Next Permutation
https://leetcode.com/problems/next-permutation/#/descriptionclass Solution(object): def nextPermutation(self, nums): """ :type nums: List[int] :rtype: void Do not retur原创 2017-07-13 12:06:23 · 343 阅读 · 0 评论 -
python写算法题:leetcode: 20. Valid Parentheses
https://leetcode.com/problems/valid-parentheses/#/descriptionclass Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ stab='(){}[原创 2017-06-13 11:03:48 · 358 阅读 · 0 评论 -
python写算法题:leetcode: 21. Merge Two Sorted Lists
https://leetcode.com/problems/merge-two-sorted-lists/#/description# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.原创 2017-06-13 11:25:43 · 657 阅读 · 0 评论 -
python写算法题:leetcode: 28. Implement strStr()
https://leetcode.com/problems/implement-strstr/#/descriptionclass Solution(object): def kmpTab(self, needle): nlen = len(needle) tab = [0]*nlen j = 0 for i原创 2017-07-04 19:42:02 · 330 阅读 · 0 评论 -
python写算法题:leetcode: 29. Divide Two Integers
https://leetcode.com/problems/divide-two-integers/#/descriptionclass Solution(object): def divide(self, dividend, divisor): """ :type dividend: int :type divisor: int原创 2017-07-04 19:43:44 · 339 阅读 · 0 评论 -
python写算法题:leetcode: 22. Generate Parentheses
class Solution(object): def generateParenthesis(self, n): """ :type n: int :rtype: List[str] """ if n<1: return [] braces=set() braces.add('原创 2017-06-15 12:03:25 · 349 阅读 · 0 评论 -
python写算法题:leetcode: Add to List 33. Search in Rotated Sorted Array
https://leetcode.com/problems/search-in-rotated-sorted-array/description/class Solution(object): def search(self, nums, target): """ :type nums: List[int] :type target:原创 2017-08-01 09:14:21 · 256 阅读 · 0 评论 -
python写算法题:leetcode: Add to List 34. Search for a Range
https://leetcode.com/problems/search-for-a-range/description/class Solution(object): def searchRange(self, nums, target): """ :type nums: List[int] :type target: int原创 2017-08-01 09:17:05 · 306 阅读 · 0 评论 -
python写算法题:leetcode: 35. Search Insert Position
https://leetcode.com/problems/search-insert-position/description/class Solution(object): def searchInsert(self, nums, target): """ :type nums: List[int] :type target: i原创 2017-08-01 09:18:43 · 395 阅读 · 0 评论 -
python写算法题:leetcode: 32. Longest Valid Parentheses
https://leetcode.com/problems/longest-valid-parentheses/#/descriptionclass Solution(object): def longestValidParentheses(self, s): """ :type s: str :rtype: ins原创 2017-07-29 11:13:49 · 299 阅读 · 0 评论 -
python写算法题:leetcode: 36. Valid Sudoku
https://leetcode.com/problems/valid-sudoku/description/测试用例少量未通过,分析原因,本程序判断条件更严格,有些明显存在矛盾填写方式,被认定非法数独,所以不认为是错误。class Solution(object): def isValidSudoku(self, board): """ :ty原创 2017-12-12 01:14:37 · 325 阅读 · 0 评论 -
用CatBoost做音素识别
1,下载TIMIT语料库,解压,全部目录,文件变小写,按照NLTK要求,修改所有根目录下的.txt配置文件2,安装必要python库:nltk, librosa,numpy,catboost3, 实现训练过程,原理:TIMIT中wav格式并非标准RIFF格式,好在格式简单,每个文件头占1024字节,文本格式,剩下的是pcm raw data,录制格式是单声道,16bit 16KHz,安装原创 2017-12-11 11:13:35 · 1720 阅读 · 0 评论 -
python写算法题:leetcode: 36. Valid Sudoku
class Solution(object): def isValidSudoku(self, board): """ :type board: List[List[str]] :rtype: bool """ box={} box2={} runloop=False ...原创 2019-04-26 03:46:18 · 132 阅读 · 0 评论 -
python写算法题:leetcode: 37. Sudoku Solver
import mathclass Solution(object): def mask(self, box, i, j): v=(1<<9)-1 for i0 in xrange((i/3)*3, (i/3)*3+3): for j0 in xrange((j/3)*3, (j/3)*3+3): ...原创 2019-04-26 04:04:08 · 218 阅读 · 0 评论 -
python写算法题:leetcode: 42. Trapping Rain Water
class Solution(object): def swap(self, items, ind, i, j): tmp=items[i] items[i]=items[j] items[j]=tmp tmp=ind[i] ind[i]=ind[j] ind[j]=tmp def q...原创 2019-05-01 22:50:41 · 214 阅读 · 0 评论 -
python写算法题:leetcode: 43. Multiply Strings
class Solution(object): def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ resv=[] p1=((len(num1)+3)/4)*4...原创 2019-05-01 23:29:37 · 144 阅读 · 0 评论 -
python写算法题:leetcode: 38. Count and Say
class Solution(object): def countAndSay(self, n): """ :type n: int :rtype: str """ if n==1: return "1" ret=self.countAndSay(n-1) lastc=0 ...原创 2019-04-28 03:54:15 · 170 阅读 · 0 评论