自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Mereder的博客

学习积累

  • 博客(84)
  • 收藏
  • 关注

原创 使用pip install 之后pip消失 ModuleNotFoundError: No module named 'pip'

背景:在安装torch的时候,pip install torch 然后安装失败,告诉我需要更新我的pip,于是我更新了自己的pip,就是常规操作:pip install --upgrade pip,更新居然失败了。很神奇,那就再尝试一次吧。然后更神奇居然直接==找不到pip了:ModuleNotFoundError: No module named '...

2019-08-13 20:47:00 1196

原创 剑指Offer——表示数值的字符串 Java

题目描述请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。例如,字符串"+100",“5e2”,"-123",“3.1416"和”-1E-16"都表示数值。 但是"12e",“1a3.14”,“1.2.3”,"±5"和"12e+4.3"都不是。解题思路对思考的完备性:最复杂的 “+123.123e+123”先确定有无正负号,然后判断是否是个整数,当非数字字符时候 再判断是否...

2019-05-20 22:39:14 197

原创 Leetcode 437 Path Sum III

题目链接:437. Path Sum III题目描述You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to...

2019-05-20 22:32:00 131

原创 Leetcode 113 Path Sum II

题目链接:113. 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.Note: A leaf is a node with no children.简而言之,就是在...

2019-05-20 21:02:00 92

原创 Leetcode 112 PathSum

题目链接:112. 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.Note: ...

2019-05-20 20:56:00 104

原创 剑指Offer——二叉树的下一个结点

题目描述给定一个二叉树和其中的一个结点,请找出中序遍历顺序的下一个结点并且返回。注意,树中的结点不仅包含左右子结点,同时包含指向父结点的指针。(实际题目给的是二叉树中的一个结点,给出该结点的下一个结点)解题思路一棵树中,给定其中的一个结点,我们分别分析下,在中序遍历条件下,该结点的下一个结点在哪:(建议大家画图理解下)因为是中序遍历,该结点的左...

2019-05-20 20:49:00 107

原创 将博客搬至CSDN

test

2019-05-19 21:20:00 59

原创 快速排序的总结和优化

快排的基本框架就是下边这样。更鲁棒一点的话,还需要考虑传入的array是否是非法参数。此处优化:应当将数组,打乱顺序,如果数组基本有序,快排的时间复杂度将退化到O(n2)O(n^2 )O(n2)应该在传入sort之前就将数组 shuffle。public static void sort(int[] array,int lo ,int hi){ if (array == null |...

2019-05-19 21:14:01 135

原创 剑指Offer——字符串的旋转

问题一:左旋转字符串题目描述汇编语言中有一种移位指令叫做循环左移(ROL),现在有个简单的任务,就是用字符串模拟这个指令的运算结果。对于一个给定的字符序列S,请你把其循环左移K位后的序列输出。例如,字符序列S=”abcXYZdef”,要求输出循环左移3位后的结果,即“XYZdefabc”。是不是很简单?OK,搞定它!解题思路如果没有看《剑指》,自己...

2019-05-19 20:51:00 120

原创 Python 函数的参数传递*args和**kwargs

参数传递机制具有值传递(int、float等值数据类型)和引用传递(以字典、列表等非值对象数据类型为代表)两种基本机制。值传递,应用的参数不发生更改。(传了个副本进去)a = 5print(a)def test(a): a+=1 print("函数内:%d" % a)test(a)print(a)​```output5函数内:65​```引用传递,引用的参...

2019-05-13 15:09:45 9558

原创 Python 函数的参数传递\*args和\**kwargs

Python 函数的参数传递*args和**kwargs参数传递机制具有值传递(int、float等值数据类型)和引用传递(以字典、列表等非值对象数据类型为代表)两种基本机制。值传递,应用的参数不发生更改。(传了个副本进去)a = 5print(a)def test(a): a+=1 print("函数内:%d" % a)tes...

2019-05-13 15:07:00 764

原创 动态规划总结——通过例题疏通你

动态规划多阶段决策的过程:每一步求解的问题是后面阶段求解问题的子问题,每一步决策都将依赖于以前决策的结果优化函数值之间存在依赖关系优化函数的特点:任何最短路的子路径相对于子问题始、终点最短一定要存在依赖关系!一定要满足优化原则或最优子结构性质设计要素多阶段决策过程,每步处理一个子问题,界定子问题的边界列出优化函数的递推方程以及初值问题满足优化原则或最优子结构性质。一个最优决策序列...

2019-05-11 20:08:04 327

原创 Leetcode 96 Unique Binary Search Trees

题目链接:96. Unique Binary Search Trees题目描述Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n?简而言之:给定1...n这N个数,问有多少种构造BST的方案。Example:Inpu...

2019-05-11 19:38:00 87

原创 Leetcode 343 Integer Break

题目描述Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.Exampl...

2019-05-11 19:36:00 70

原创 Leetcode 136 Single Number

题目链接:136. Single Number题目描述Given a non-empty array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runti...

2019-05-11 19:09:00 75

原创 Leetcode 412 Fizz Buzz

题目链接:412. Fizz Buzz题目描述Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number an...

2019-05-11 09:50:00 83

原创 Leetcode 287 Find the Duplicate Number

题目链接:Find the Duplicate Number题目描述Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must ...

2019-05-11 09:36:00 82

原创 剑指Offer——链表的环以及环的入口

题目描述在一个排序的链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留,返回链表头指针。 例如,链表1->2->3->3->4->4->5 处理后为 1->2->5解题思路这个题包含两个子问题,一个是判断链表是否有环,另一个是如果有环,找到环的入口。对于如何判断链表有环问题,较为基础...

2019-05-11 09:34:00 132

原创 Leetcode 701 Insert into a Binary Search Tree

题目链接:701. Insert into a Binary Search Tree题目描述Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return t...

2019-05-10 16:37:00 90

原创 Leetcode 98 Validate Binary Search Tree

题目链接:98. Validate Binary Search Tree题目描述Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node...

2019-05-10 16:20:00 75

原创 Leetcode 637 Average of Levels in Binary Tree

题目链接:637. Average of Levels in Binary Tree题目描述Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Example 1:Input: 3...

2019-05-10 10:41:00 75

原创 Leetcode 654 Maximum Binary Tree

题目链接: 654. Maximum Binary Tree题目描述Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is the maximum number in the a...

2019-05-10 10:31:00 66

原创 Leetcode 107 Binary Tree Level Order Traversal II

题目链接:Binary Tree Level Order Traversal II题目描述Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from l...

2019-05-09 23:27:00 73

原创 Leetcode 965 Univalued Binary Tree

题目链接 965 Univalued Binary Tree题目描述A binary tree is univalued if every node in the tree has the same value.Return true if and only if the given tree is univalued.简而言之 问树的所有值是不是...

2019-05-09 22:06:00 84

原创 剑指Offer——将二叉树按之字形打印

题目描述请实现一个函数按照之字形打印二叉树,即第一行按照从左到右的顺序打印,第二层按照从右至左的顺序打印,第三行按照从左到右的顺序打印,其他行以此类推。二叉树样例(图片来自百度百科)按之字形打印:FE CA D H GM B解题思路还是基于层次遍历进行改装。如果根节点算第一层的话,那么就是奇数层从左到右,偶数层从右到左。详...

2019-05-08 21:39:00 89

原创 剑指Offer——将二叉树打印成多行

题目描述从上到下按层打印二叉树,同一层结点从左至右输出。每一层输出一行。相比较层次遍历二叉树,这个地方要求每输出一行都需要换行。重点思考的地方也就是,如何判断一行打印完了,进行下一行的打印。解题思路先从层次遍历开始,借用队列结构,会依次把下一层的结点加入队列中。那么如何判断一行打印完了?实际上一次操作的过程中,我们会涉及到当前层结点的出队,和...

2019-05-08 16:31:00 51

原创 Leetcode 121 Best time to buy and sell stock

题目描述Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy one and sell...

2019-05-07 22:21:00 46

原创 Leetcode 122 Best time to buy and sell stockII

问题描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions ...

2019-05-07 22:21:00 51

原创 Keras 入门——实现全连接和简单卷积网络

前言MNIST 数字识别问题的全连接实现和LeNet-5实现。Keras是目前最为广泛的深度学习工具之一,底层可以支持Tensorflow、MXNet、CNTK、Theano。通过Keras我们深度学习过程基本可以简化为:数据处理、模型定义、模型训练。tensorflow版本: 1.13.1Keras版本:2.2.4运行环境:Google CoL...

2019-05-07 14:40:00 5476

原创 Leetcode 88 Merge Sorted Array

题目描述Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.简而言之:合并两个数组到数组1中,数组1 有足够大的空间。Note:The number of elements initialized in nums1 ...

2019-05-06 11:14:00 57

原创 Leetcode 977 Squares of Sorted array

题目描述Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order.简而言之:将一个非递减序列,按照元素乘方的大小排序。返回乘...

2019-05-06 10:59:00 70

原创 Leetcode 832 Flipping an Image

题目描述Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image.To flip an image horizontally means that each row of the imag...

2019-05-06 10:43:00 64

原创 Leetcode 905 Sort Array By Parity

题目描述Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.You may return any answer array th...

2019-05-06 10:17:00 55

原创 Leetcode 129 Sum Root to Leaf Numbers

题目描述Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the n...

2019-05-05 19:12:00 83

原创 Leetcode 147 insertion Sort List

题目描述Sort a linked list using insertion sort.imageA graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the l...

2019-05-05 19:02:00 72

原创 Leetcode 328 Odd Even Linked List

问题描述Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You...

2019-05-05 14:03:00 75

原创 剑指Offer——二叉搜索树与双向链表

题目描述输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向。解题思路二叉搜索树的中序遍历,就是二叉搜索树的顺序排序。二叉树的中序遍历,实际上分为了3个部分,左子树,根,右子树。当遍历完左子树时,左子树已经是一个排好序的链表了,并且链表中的最后一个结点,是当前的最大值。只需要将根节点跟链表...

2019-05-03 16:28:00 69

原创 Leetcode 445 Add Two Numbers II

题目描述You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add th...

2019-05-03 14:58:00 72

原创 Leetcode 148 sort list

题目描述Sort a linked list in O(n log n) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3-&gt...

2019-05-03 10:29:00 52

原创 Tensorflow入门

前言马马虎虎学了一遍,面试时候让我tensorflow手写一个简单的前向传播反向训练过程,发现自己根本写不出来,好多函数用的不多,都是搬代码,天道好轮回,苍天饶过谁......主要内容来源于《Tensorflow实战Google深度学习框架》,更注重tensorflow的基础。以一个简单的为例,实现一个简单的神经网络单层结构。实践过程如下im...

2019-04-30 15:36:00 64

空空如也

空空如也

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

TA关注的人

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