- 博客(9)
- 资源 (2)
- 收藏
- 关注
原创 python 模拟登陆leetcode
模拟登陆,首先要知道提交页面的网址,和每次post的内容,采用chrome的浏览器的开发者工具,查看。得到下图可以看到提交的内容包括”csrfmiddlewaretoken”、”login”、”password”,后两个是用户名和密码,第一个应该是一中验证机制,每次打开页面都会随机生成一个,果不其然,在网页的代码中找到 这样,我们只要每次把登陆界面的csrf值扣出来,然后放到和用户名,密码放到一个
2016-03-25 20:41:52 4467 4
原创 Numpy库进阶教程(一)求解线性方程组
前言Numpy是一个非常强大的python科学计算库,为了机器学习的需要,想深入研究一下Numpy库的用法,用这个系列的博客,记录下我的学习过程。 系列: Numpy库进阶教程(二) 正在持续更新计算逆矩阵numpy.linalg模块包含线性代数的函数,可以用来求矩阵的逆,求解线性方程组、求特征值及求解行列式。 mat函数可以用来构造一个矩阵,传进去一个专用字符串,矩阵的行与行之间用分号隔开
2016-03-28 11:08:02 19422
原创 python得到所有在leetcode上Accepted的代码(一)
得到cookies要得到所有提交成功的代码,必须先登录你的账号,得到你的cookies,这点我已经在先前的博文python 模拟登陆leetcode中详细讲述了。 url = "https://leetcode.com/submissions/" res = s.get(url=url,headers=headers_base,cookies=login()) c
2016-03-27 09:38:58 3194
原创 [leetcode] Pow(x, n)
题目:Implement pow(x, n).分析: 题目很短,就是实现pow求幂函数,直觉告诉我,这个题目的主要要求是降低程序的时间复杂度,果不其然,提交了一份带有while循环复杂度是O(n)的代码,返回“Time Limit Exceed“的错误,初次提交代码:class Solution {public: double myPow(double x, int n) {
2016-03-23 19:41:17 1623
原创 [leetcode]Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \
2016-03-22 19:41:51 1273
原创 [leetcode]Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \
2016-03-22 16:14:21 848
原创 [leetcode]Minimum Depth of Binary Tree--二叉树层序遍历的应用
题目:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.分析: 要得出二叉树中所有从根到叶子节点路径中,经过结点最少路径上的节点数。
2016-03-16 18:16:46 1190
原创 [leetcode]Path Sum--巧用递归
题目:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum =
2016-03-14 13:50:54 1650
原创 [leetcode] Symmetric Tree--二叉树遍历的应用
题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the following is
2016-03-12 23:13:55 1332
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人