摘要: 树 二叉树 1. Leetcode 100 Same Tree class Solution { public: bool isSameTree(TreeNode* p, TreeNode* q) { if(p==NULL && q==NULL) return true; if(p!=NULL && 阅读全文
posted @ 2020-04-16 22:47 jenny1000000 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Longest Substring without repeating characters Question Given a string, find the length of the longest substring without repeating characters. Example 阅读全文
posted @ 2019-05-31 23:19 jenny1000000 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Add two numbers Question You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and e 阅读全文
posted @ 2019-05-31 23:17 jenny1000000 阅读(183) 评论(0) 推荐(0) 编辑
摘要: Question : Two Sum 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 阅读全文
posted @ 2019-05-31 23:14 jenny1000000 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 1. 不需要存储 例如,输入一组个数未知的数,将它们求和输出。 在连续输入数字的过程中可以用空格或者回车将数字隔开。 最后用EOF停下来,Win下就是在最后一个输入后回车,ctrl+Z,再回车。UNIX下是ctrl+D。 再比如输入字符串,同样不需要存储,直接将读取的内容打印到屏幕上。 在输入的时候 阅读全文
posted @ 2017-11-29 09:55 jenny1000000 阅读(685) 评论(0) 推荐(0) 编辑
摘要: 之前每次安装都各种报错,放弃了无数次。 终于找到了一个“亲测可用”的方法。 mac下自带python 2.7.10 S1 升级pip安装工具: sudo python -m pip install --upgrade --force pip S2 安装setuptools: sudo pip ins 阅读全文
posted @ 2017-11-02 11:15 jenny1000000 阅读(567) 评论(0) 推荐(0) 编辑
摘要: 1. 查看SIP状态 在终端中输入csrutil status,就可以看到是enabled还是disabled。 2. 关闭SIP S1 重启MAC,按住cmd+R直到屏幕上出现苹果的标志和进度条,进入Recovery模式; S2 在屏幕最上方的工具栏找到实用工具(左数第3个),打开终端,输入:cs 阅读全文
posted @ 2017-11-02 11:08 jenny1000000 阅读(15174) 评论(1) 推荐(0) 编辑
摘要: 一. 信息论背景 信息论的研究内容,是对一个信号包含信息的多少进行量化。所采用的量化指标最好满足两个条件: (1)越不可能发生的事件包含的信息量越大; (2)独立事件有增量的信息(就是几个独立事件同时发生的信息量等于每一个信息量的和)。 遵循以上原则,定义一个事件$\mathsf{x}=x$的自信息 阅读全文
posted @ 2017-10-29 16:07 jenny1000000 阅读(4793) 评论(0) 推荐(0) 编辑
摘要: PIL与setuptools不兼容,而且从2009年就停止更新了,本文中采用了Pillow。 Pillow与PIL模块不能同时安装,但是在import的时候仍然要用PIL来代替Pillow。 Pillow中最重要的一个模块就是Image。 1.图像的加载、显示和保存 # !/usr/bin/pyth 阅读全文
posted @ 2017-03-17 21:42 jenny1000000 阅读(819) 评论(0) 推荐(0) 编辑
摘要: numpy中主要有两种数据类型——矩阵matrix和数组array。同样的操作在两种数据类型上可能会体现出不同的效果。matrix类型与matlab中的matrices类型比较接近。 from numpy import * 1. 建立一个随机数组 random.rand(4,4) #4*4随机数组 阅读全文
posted @ 2017-02-19 12:18 jenny1000000 阅读(120) 评论(0) 推荐(0) 编辑