自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(56)
  • 收藏
  • 关注

原创 SICP 笔记 Lec2b Compound Data Part 3 & Part 4

Lec2b 复合数据Compound DataPart 341" - 56"从有理数类比到用二维坐标来表示点的位置,而两个点即可表示一个线(向量)。1.引入Closure(闭包)的概念我的理解:所有的object可以被“完整”地封装,作为其他object的一部分。这个过程可以无穷无尽地进行下去,其所有的性质不会损耗。即“道生一,一生二,二生三,三生万物”。(如fortan就的数组(arrays)就不具有这种性质,array的元素不能是array。2.利..

2021-10-19 01:15:35 180

原创 [Leetcode]87. Scramble String

[[Leetcode]87.Scramble String](https://leetcode.com/problems/scramble-string/)- 本题难度: Hard- Topic: divide and conquere# DescriptionGiven a strings1, we may represent it as a binary tree by par...

2019-07-27 15:02:01 202

原创 [Leetcode]658. Find K Closest Elements

# [[Leetcode]658.Find K Closest Elements](https://leetcode.com/problems/find-k-closest-elements/)- 本题难度: Hard/Medium- Topic: Data Structure# Description# 我的代码```pythonimport bisectclass ...

2019-07-27 14:58:33 280

原创 [Leetcode]981. Time Based Key-Value Store

# [[Leetcode]981.Time Based Key-Value Store](https://leetcode.com/problems/time-based-key-value-store/)- 本题难度: Medium# DescriptionCreate a timebased key-value store classTimeMap, that supports...

2019-07-27 14:50:11 198

原创 [Lintcode] 932. Beautiful Array

# [Leetcode:932.Beautiful Array](https://leetcode.com/problems/beautiful-array/)- 本题难度: Hard- Topic:divide-and-conquer# DescriptionFor some fixedN, an arrayAisbeautifulif it is a permuta...

2019-07-27 14:47:18 154

原创 [Lintcode]739. 24 Game/[Leetcode]679. 24 Game

#[Lintcode]739. 24 Game/[Leetcode]679. 24 Game本题难度: Hard/Medium## DescriptionYou have 4 cards each containing a number from 1 to 9. You need to judge whether they could operated through*,/,+,...

2019-07-15 22:16:32 233

原创 使用python的http服务快速地在服务器,本地之间传递文件

进入要传输文件的文件夹输入 python3 -m http.server得到当在本地输入时,出现Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...将0.0.0.0替换成本地ip(本地ip可以通过cmd中输入ipconfig/all,查看IPv4的地址得到。如果是服务器,直接会出现http://[服务器ip]...

2019-04-03 17:11:41 854

原创 from PIL import Image except ImportError, v: SyntaxError: invalid syntax

报错:except ImportError, v: SyntaxError: invalid syntax报错位置: from PIL import Image原因: 我下载的是PIL库,这个是针对python2的,而我目前使用的interpreter是python3。重新下载pillow库即可。...

2019-04-03 16:36:48 1736

原创 [备考]腾讯优图后台二面

智能指针为了解决C++中分配了内存之后忘记delete,造成悬空指针的情况。从而造成了内存的泄漏。智能指针可以更好地控制对象的生命周期。智能指针分为std::auto_ptr、boost::scoped_ptr、boost::shared_ptr、boost::scoped_array、boost::shared_array、boost::weak_ptr、boost:: intrusiv...

2019-03-30 20:34:59 746

原创 [Lintcode]115. Unique Paths II/[Leetcode]63. Unique Paths II

#115. Unique Paths II/63. Unique Paths II本题难度: Easy/MediumTopic: Dynamic ProgrammingDescriptionFollow up for “Unique Paths”:Now consider if some obstacles are added to the grids. How many uniqu...

2019-03-27 02:37:33 170

原创 [Leetcode]62. Unique Paths

62. Unique Paths本题难度: EasyTopic: Dynamic ProgrammingDescriptionA robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either dow...

2019-03-27 02:34:43 139

原创 [Lintcode]108. Palindrome Partitioning II /[Leetcode]132. Palindrome Partitioning II

108. Palindrome Partitioning II / 132. Palindrome Partitioning II本题难度: Medium/HardTopic: DPDescriptionGiven a string s, partition s such that every substring of the partition is a palindrome.Re...

2019-03-27 02:29:03 141

原创 [Lintcode]136. Palindrome Partitioning /[Leetcode]131. Palindrome Partitioning

136. Palindrome Partitioning / 131. Palindrome Partitioning本题难度: MediumTopic: Search DFSDescriptionGiven a string s, partition s such that every substring of the partition is a palindrome.Retur...

2019-03-27 01:50:27 126

原创 [Lintcode]120. Word Ladder /[Leetcode]127. Word Ladder

120. Word Ladder / 127. Word Ladder本题难度: Hard/MediumTopic: Data StructureDescriptionGiven two words (start and end), and a dictionary, find the length of shortest transformation sequence from st...

2019-03-26 02:15:09 159

原创 图片损坏的情况

/data/anaconda/envs/py35/lib/python3.5/site-packages/PIL/Image.py:2514: DecompressionBombWarning: Image size (98130452 pixels) exceeds limit of 89478485 pixels, could be decompression bomb DOS attack....

2019-03-25 14:47:52 1893

原创 tensorflow.python.framework.errors_impl.InvalidArgumentError: image_size must contain 3 elements[4]

tensorflow.python.framework.errors_impl.InvalidArgumentError: image_size must contain 3 elements[4]出现了很多非RGB格式的图片。解决方法:由于该类图片较多,所以选择将它们转化为RGB格式之后再储存。#encoding:utf-8from PIL import Imageimport o...

2019-03-25 14:05:48 1324

原创 [后台]常见问题

TCP和UDP的区别聊聊IO多路复用之select、poll、epoll详解C++ STL 几个容器的底层实现 收藏一下细说new与malloc的10点区别

2019-03-19 20:50:53 267

原创 [后台]腾讯优图-电面-一面

因为自己拖拖拉拉导致HC取消,之后投优图被后台的人捞了简历。之前没复习过后台,半个小时随便看了看。只能说,碰到啥是啥了。STL中stack和map的原理stack是数组实现的,map是红黑树实现的,map的存取时间复杂度是O(logN)vector内存不够了的话怎么处理)内存中堆和栈的有什么不同TCP协议三次握手和四次挥手的过程Linux怎么查看计算机运行状态/内存占用情况数据库...

2019-03-19 20:29:45 658

原创 [Tensorflow] TFRecord介绍和教程

官方tutorials Using TFRecords and tf.Example我的理解:在图像转化为tfrecord时,是将图像转换成一系列二进制记录( a sequence of binary records binary records),用{“string”: value}来存储高,宽,channel以及label。Protocol buffers 是一种跨平台、语言的搞笑的序列...

2019-03-15 17:18:32 246

原创 Python将数据集分成train/validation/test,并平衡数据

1. 将数据集分成train/validation/test比例 7:2:1import os, random, shutil#-*- coding: UTF-8 -*-import osimport randomimport shutildef eachFile(filepath): name_list = [] pathDir = os.listdir(fi...

2019-03-14 10:59:40 5164

原创 设置jupyter远程连接

配置生成文件$jupyter notebook --generate-config生成文件为/home/你的用户名/.jupyter/jupyter_notebook_config.py2. 生成密码法1: 利用ipython生成密码In [1]: from notebook.auth import passwdIn [2]: passwd()Enter password:V...

2019-03-12 12:54:23 684

翻译 使用Anacoda设置Tensorflow的虚拟环境

参考: TensorFlow in AnacondaTensorflow CPUconda create -n tensorflow_env tensorflowconda activate tensorflow_envTensorflow GPU versionconda create -n tensorflow_gpuenv tensorflow-gpuconda activat...

2019-03-12 11:02:28 706

翻译 Linux安装anaconda

参考:Installing on Linux下载 地址accept terms: 输入yes确定安装地址:如果不做修改将下载在/home/你的用户名/anaconda3里。更新配置文件 /home/你的用户名/.bashrc选择yes,并且备份该文件在/home/你的用户名/.bashrc-anaconda3.bak中 (.bak文件记录一次重启错备份文件脚本造成的错误。)重新打开终端...

2019-03-12 10:50:46 169

原创 搭环境时遇到的各种问题

远程使用服务器服务器+jupyter notebookjupyter 没有python3服务器+pycharm远程连接参考:Pycharm连接远程服务器并实现远程调试查看python3’s interpret的位置:which python3 参考:linux 查看python安装路径,版本号Linux 各种包不全ImportError: No module named ‘...

2019-03-11 17:13:33 223

原创 Linux + Shell学习

Mar 11, 2019wc参考可以很方便地用于计算文件夹中文件个数,文档中一共有多少行。-l 行数-c Bytes数-w 字数bc用于计算,可以用作浮点数计算,进制转换。浮点数计算:$ echo 'scale=2; (2.777 - 1.4744)/1' | bc1.30进制转换ibase 设置输入数据的进制obase 输出的数据进制$ echo "ibase=2...

2019-03-11 17:09:03 185

原创 Lintcode Ladder2 总结

1. String[Lintcode Ladder2] String13.Implement strStr()KMP算法171.Anagrams对之前代码对改进:item_ = str(sorted(item))注意要转换成string,因为list不能作为dictionary对hash表的key。79. Longest Common Substring再看一次还是没有思路,·...

2019-02-21 04:22:26 694

原创 [Lintcode]132. Word Search II /[Leetcode]212. Word Search II

132. Word Search II / 212. Word Search II本题难度: HardTopic: Data Structure - Tire/DFSDescriptionGiven a 2D board and a list of words from the dictionary, find all words in the board.Each word mus...

2019-02-18 22:51:00 183

原创 [Leetcode]79. Word Search

79. Word Search本题难度: MediumTopic: DFSDescriptionGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where “a...

2019-02-18 20:29:20 150

原创 [Lintcode]4. Ugly Number II/[Leetcode]264. Ugly Number II

4. Ugly Number II / 264. Ugly Number II本题难度: MediumTopic: Data StructureDescriptionUgly number is a number that only have factors 2, 3 and 5.Design an algorithm to find the nth ugly number. The...

2019-02-17 22:36:47 126

原创 [Lintcode]12. Min Stack /[Leetcode]155. Min Stack

12. Min Stack / 155. Min Stack本题难度: Medium/EasyTopic: Data StructureDescriptionimport heapqimport collectionsclass MinStack:def __init__(self): """ initialize your data structure here...

2019-02-17 21:19:52 233

原创 [Leetcode]225. Implement Stack using Queues

225. Implement Stack using QueuesImplement the following operations of a stack using queues.push(x) – Push element x onto stack.pop() – Removes the element on top of the stack.top() – Get the top ...

2019-02-17 20:33:34 134

原创 [Lintcode] 40. Implement Queue by Two Stacks/[Leetcode]225. Implement Stack using Queues

40. Implement Queue by Two Stacks / 225. Implement Stack using Queues本题难度: Medium/EasyTopic: Data Structure - stack/queueDescriptionAs the title described, you should only use two stacks to impl...

2019-02-17 20:13:06 160

原创 [Lintcode]128. Longest Consecutive Sequence/[Leetcode]23. Merge k Sorted Lists

128. Longest Consecutive Sequence / 23. Merge k Sorted Lists本题难度: Hard/MediumTopic: Data StructureDescriptionMerge k sorted linked lists and return it as one sorted list.Analyze and describe it...

2019-02-17 16:55:23 206

原创 [Lintcode]124. Longest Consecutive Sequence/[Leetcode]128. Longest Consecutive Sequence

124. Longest Consecutive Sequence/128. Longest Consecutive Sequence本题难度: Medium/HardTopic: Data StructureDescriptionGiven an unsorted array of integers, find the length of the longest consecutiv...

2019-02-17 15:14:18 118

原创 [Leetcode]744. Find Smallest Letter Greater Than Target

744. Find Smallest Letter Greater Than TargetDescriptionGiven a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in th...

2019-02-05 11:11:50 270 2

原创 [Leetcode]34. Find First and Last Position of Element in Sorted Array

34. Find First and Last Position of Element in Sorted ArrayDescriptionGiven an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.Your a...

2019-02-04 18:13:32 142

原创 [Lintcode]159. Find Minimum in Rotated Sorted Array

159. Find Minimum in Rotated Sorted ArrayDescriptionSuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum elem...

2019-02-04 18:05:08 154

原创 [Lintcode] 14. First Position of Target

14. First Position of TargetDescriptionFor a given sorted array (ascending order) and a target number, find the first index of this number in O(log n) time complexity.If the target number does not ...

2019-02-04 17:50:39 216

原创 [Lintcode]141. Sqrt(x)

141. Sqrt(x)DescriptionSqrt(x)Implement int sqrt(int x).Compute and return the square root of x.ExampleExample 1:Input: 0Output: 0Example 2:Input: 3Output: 1Explanation:return the lar...

2019-02-04 02:21:57 158 1

原创 [Lintcode]60. Search Insert Position

60. Search Insert PositionDescriptionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You ma...

2019-02-04 02:01:40 153

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除