wangyp

博客园 首页 联系 订阅 管理

12 2018 档案

摘要:算法考点: 01.递归:代码简洁 02.循环:栈来模拟递归 03.排序算法:快速排序、归并排序 04.查找算法:二分查找 05.回溯法:二维数组搜索路径 06.动态规划DP:最优解 07.贪婪算法:存在特殊选择的情况 08.位运算:与或非、异或、左移、右移 09.分治法:divide and con 阅读全文
posted @ 2018-12-12 19:12 wangyp 阅读(176) 评论(0) 推荐(0)

摘要:如何刷题?就是200道题! 原则: 生长学习法+科学练习 生长学习法: 你是怎么想到的?思路!==》思路报告! 思路报告: 01.题目 02.例子 03.题目假设 04.重要问题 05.直觉 06.解决方法的可能性 07.解决方案 08.数据结构 09.算法复杂度:时间空间 总结: 要有脑子! 阅读全文
posted @ 2018-12-04 17:57 wangyp 阅读(180) 评论(0) 推荐(0)

摘要:class MyQueue(object): def __init__(self, ): """ Initialize your data structure here. """ self.instack = [] self.outstack = [] def push(self, x): ... 阅读全文
posted @ 2018-12-04 17:43 wangyp 阅读(147) 评论(0) 推荐(0)

摘要:s = 'we are happy's = s.replace(' ','%20')print s s = 'we are happy' s = s.replace(' ','%20') print s 阅读全文
posted @ 2018-12-04 17:39 wangyp 阅读(89) 评论(0) 推荐(0)

摘要:# -*- coding:utf-8 -*- from collections import Counter class Solution(object): def findRepeatNum(self,input_list): if not input_list: return c = Counter(input_list) ... 阅读全文
posted @ 2018-12-04 17:38 wangyp 阅读(112) 评论(0) 推荐(0)

摘要:# -*- coding:utf-8 -*- class Solution(object): def fNumInSorted(self,input_list,target_num): if not input_list: return if not target_num: return r... 阅读全文
posted @ 2018-12-04 17:38 wangyp 阅读(122) 评论(0) 推荐(0)