自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 剑指offer -- 数值的整数次方

描述:给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。分析:求double类型的exponent次方思路一:递归。由于次方可以看做一个不断相乘的过程,因此每次递归调用函数进行相乘就可以达到目的。class Solution {public: double Power(double base, int exponent...

2019-02-27 09:50:21 198

原创 剑指offer -- 包含min函数的栈

描述:定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度应为O(1))。分析:实现一个栈,其中有一个函数可以返回这个栈中最小元素的值,要求min函数时间复杂度为O(1)。思路一:这题关键在于pop之后最小值有可能会发生变化,关键在于如何处理这种变化过程。这里我使用map用来处理这种变化状态,理由有以下几点:1.栈中存在重复元素,用map的value记录比...

2019-02-23 17:24:32 202

原创 datitran--generate_tfrecord.py使用踩坑记录

系统环境:macOS Mojavevirtualenvpython 2.7坑点一:No module named ‘object_detection’解决方式:添加环境变量a.使用终端打开文件 touch .bash_profile open -e .bash_profileb.在文件中添加并保存环境变量添加PYTHONPATH=$PYTHONPATH:/your/...

2019-02-19 15:53:53 1313

原创 剑指offer -- 用两个栈实现队列

描述:用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。分析:用两个栈来实现队列,一个栈用来存储Push的值,用另一个栈来进行Pop操作。思路一:class Solution{public: void push(int node) { stack1.push(node); } int pop() { ...

2019-02-10 13:51:42 195

原创 剑指offer -- 反转链表

描述:输入一个链表,反转链表后,输出新链表的表头。分析:参考LeetCode Problem – 206. Reverse Linked List思路一:迭代。/*struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { }};*/class Sol...

2019-02-10 13:18:11 184

原创 剑指offer -- 连续子数组的最大和

描述:HZ偶尔会拿些专业问题来忽悠那些非计算机专业的同学。今天测试组开完会后,他又发话了:在古老的一维模式识别中,常常需要计算连续子向量的最大和,当向量全为正数的时候,问题很好解决。但是,如果向量中包含负数,是否应该包含某个负数,并期望旁边的正数会弥补它呢?例如:{6,-3,-2,7,-15,1,2,2},连续子向量的最大和为8(从第0个开始,到第3个为止)。给一个数组,返回它的最大连续子序列的...

2019-02-10 12:44:26 193

原创 剑指offer -- 求1+2+3+4+...+n

描述:求1+2+3+…+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。分析:既然不能使用乘除法及判断操作,很容易想到递归,代码如下:class Solution {public: int Sum_Solution(int n) { if (n <= 0) return 0; ...

2019-02-08 10:18:11 476

原创 剑指offer -- 二叉树的高度

描述:输入一棵二叉树,求该树的深度。从根结点到叶结点依次经过的结点(含根、叶结点)形成树的一条路径,最长路径的长度为树的深度。分析:二叉树经典题目,关键在于使用何种方式来遍历树。思路一:递归遍历。每次调用一次递归给高度+1,最终选择左子树遍历和右子树遍历中高度大的一方。/*struct TreeNode { int val; struct TreeNode *left; stru...

2019-02-01 16:35:21 118

原创 剑指offer -- 二叉树的镜像

描述:操作给定的二叉树,将其变换为源二叉树的镜像。源二叉树: 8 / \ 6 10 / \ / \ 5 7 9 11镜像二叉树: 8 / \ 10 6 / \ / \ 11 9 7 5分析:所谓二叉树镜像是交换每个节点的左右子树得到的新树,实质上考察的是二叉树的遍历,遍历到一个节点就交换这个节点的子...

2019-01-26 20:15:43 105

原创 剑指offer -- 变态跳台阶

描述:一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。分析:这道题是跳台阶的升级版,其中的难点在于如何找出递推公式并将其化简,推导步骤如下:当只有一级台阶时,只有一种上楼方式,即f(1) = 1当有两级台阶时,和跳台阶相同,有两种上楼方式,即f(2) = 2当有三级台阶时,f(3) = f(1) + f(2)…当有n-1级...

2019-01-26 09:59:24 387

原创 剑指offer -- 替换空格

描述:请实现一个函数,将一个字符串中的每个空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。分析:将给定字符串中的空格替换为’%20’思路一:先统计给定字符串中的空格个数,然后从后向前遍历字符串,把每一个字符移动到他的最终位置上去,并对空格进行填充。class Solution {public: void rep...

2019-01-26 09:02:25 147

原创 剑指offer -- 二维数组中的查找

描述:在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。分析:LeetCode有一道相同题目,具体详解可以参考我的这篇博客 ---- Leetcode problem240. Search a 2D Matrix II代码:class Soluti...

2019-01-25 21:41:50 729

原创 剑指offer --斐波那契数列

描述:大家都知道斐波那契数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项(从0开始,第0项为0)。n<=39分析:递归基础题目。从第0项开始求出n所对应的斐波那契数列,斐波那契数列递推公式如下:思路一:递归实现,简单但容易超时。class Solution {public: int Fibonacci(int n) { if (n <=...

2019-01-25 21:35:55 208

原创 剑指offer -- 跳台阶

描述:一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法(先后次序不同算不同的结果)。分析:递归经典入门题目。思路一:用递归解决,青蛙一次可以上1级或2级台阶,那么意味着每次剩余的台阶个数为n-1或n-2,即当有n级台阶时,可能的走法为上n-1级和n-2级台阶之和。由此可得递推公式:由递推公式可以写出如下解答:class Solution {p...

2019-01-25 21:26:15 401

原创 <easy>LeetCode Problem -- 155. Min Stack

描述:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack.pop() – Removes the element on top of the stack.top() – Get ...

2019-01-06 21:40:59 100

原创 <easy>LeetCode Problem -- 14. Longest Common Prefix

描述:Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string “”.Example 1:Input: [“flower”,“flow”,“flight”]Outpu...

2019-01-06 20:58:11 120

原创 <easy>LeetCode Problem -- 20. Valid Parentheses

描述:Given a string containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type o...

2019-01-05 15:28:32 124

原创 <easy>LeetCode Problem -- 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 runtime complexity. Could you implement it without...

2019-01-05 14:04:39 130

原创 Docker使用TensorFlow Serving部署模型(一)

利用Docker来使用TensorFlow Serving是最简单的一种方式,我使用的Mac作为开发环境,通过bazel编译源码的时候遇到一些奇怪的错误,最终选择通过Docker来部署模型,本文从拉取仓库开始一步一步到部署一个简单的模型 Half Plus Three。1.0 Docker 安装参照官网,下载适合版本的Docker1.1 镜像拉取这一步TensorFlow官网给出的是直接拉...

2019-01-05 13:57:00 4531 4

原创 <medium>LeetCode Problem -- 877. Stone Game

描述:Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones piles[i].The objective of the game is to...

2019-01-04 10:46:58 227

原创 <easy>LeetCode Problem -- 26. Remove Duplicates from Sorted Array

描述:Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by mod...

2019-01-04 10:16:30 82

原创 <easy>LeetCode Problem -- 929. Unique Email Addresses

描述:Every email consists of a local name and a domain name, separated by the @ sign.For example, in [email protected], alice is the local name, and leetcode.com is the domain name.Besides lowercas...

2019-01-03 23:18:27 272

原创 <easy>LeetCode Problem -- 771. Jewels and Stones

描述:You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the...

2018-12-29 20:33:23 102

原创 <easy>LeetCode Problem -- 557. Reverse Words in a String III

描述:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: “Let’s take LeetCode contes...

2018-12-29 19:56:58 109

原创 <easy>LeetCode Problem -- 292. Nim Game

描述:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will ...

2018-12-28 20:33:12 116

原创 <easy>LeetCode Problem -- 206. Reverse Linked List

描述:Reverse a singly linked list.Example:Input: 1-&amp;gt;2-&amp;gt;3-&amp;gt;4-&amp;gt;5-&amp;gt;NULLOutput: 5-&amp;gt;4-&amp;gt;3-&amp;gt;2-&amp;gt;1-&amp;gt;NULL分析:链表经典题,给定一个单链表,求将它反转之后的链表。思路一:迭代法。可以将迭代法

2018-12-28 11:33:49 110

原创 <easy>LeetCode Problem -- 237. Delete Node in a Linked List

描述:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Given linked list – head = [4,5,1,9], which looks like following:4 -&amp;gt; 5 -&amp;gt; 1 -...

2018-12-27 17:53:33 84

原创 <easy>LeetCode Problem -- 804. Unique Morse Code Words

描述:International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: “a” maps to “.-“, “b” maps to “-…”, “c” maps to “-.-.”, and so on.Fo...

2018-08-11 14:27:27 125

原创 <easy>LeetCode Problem -- 709. To Lower Case

描述: Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.Example 1: Input: “Hello” Output: “hello” Example 2:Example 2: Inpu...

2018-08-11 13:45:57 221

原创 系统分析与设计HW9

系统分析与设计HW91)使用 ECB 实现 make reservation 用例的详细设计(包含用例简介,顺序图,类图)用例图链接:https://blog.csdn.net/m0_38088298/article/details/79993065 用例简介 1.搜索酒店    1.1 选择日期    1.2 选择城市 2.预定酒店    2.1 选择酒店    2.2...

2018-07-01 09:54:39 306

原创 系统分析与设计FinalReport

系统分析与设计FinalReport自我总结通过这次使用flask框架对于app后端的开发,学习到了框架的使用方式,对前后端分离的开发方式有了一定认识,对后端的任务有了更加明确的认识。 感谢队友们的付出!!!PSP2.1统计表 PSP2.1 内容 计划时间 实际时间 Planning 计划 3h 5h · ...

2018-06-30 21:07:59 278

原创 python flask使用blueprint

python flask使用blueprint前言项目地址:https://github.com/SEN-Wanted/BackEnd blueprint作为可以将应用模块化的一个很有用的方式,大型的应用几乎所有都会采用这种模式,而在一些小项目的开发上面是否有必要采用这种模式来进行开发呢?我的意见是如果是对于团队协作的项目,最好是一开始就采用blueprint这种开发方式,以这次的项目为...

2018-06-30 15:17:12 6154 1

原创 python Flask连接mysql

Flask连接mysql写在前面关于怎样使用python部署flask,在这篇博客中我已经进行了说明。 项目链接为:https://github.com/SEN-Wanted/BackEnd项目文件结构Appserver/├── app│ ├── static/ # 静态资源文件夹│ ├── templates/ # 模板文件夹│ ├──...

2018-06-25 15:39:39 18817

原创 <easy>LeetCode Problem -- 824. Goat Latin

描述:A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to convert the sentence to “Goat Latin” (a made-up language...

2018-06-10 16:43:35 144

原创 <easy>LeetCode Problem -- 344. Reverse String

描述:Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”.分析:转换字符串的方向,水题思路一:利用for循环从后向前读取。class Solution {public: s...

2018-06-10 15:37:46 104

原创 系统分析与设计HW8

系统分析与设计HW81)描述软件架构与框架之间的区别与联系软件架构: 定义:架构(architecture)是一系列相关的抽象模式,用于指导大型软件系统各个方面的设计,是一个系统的草图,描述的对象是直接构成系统的抽象组件。各个组件之间的连接明确细致的描述组件之间的通讯。 软件框架: 定义:框架(framework)是整个或部分系统的可重用设计,表现为一组抽象构件及构件实例间交互的...

2018-06-07 19:44:36 194

原创 系统分析与设计HW7

系统分析与设计HW7说明依据这篇文章绘制用例图,活动图,状态图,系统顺序图和临域模型图。用例图活动图领域模型状态模型系统顺序图...

2018-05-15 13:13:07 246

原创 系统分析与设计HW6

系统分析与设计HW61)使用 UML State Model建模对象: 参考 Asg_RH 文档, 对 Reservation/Order 对象建模。 建模要求: 参考练习不能提供足够信息帮助你对订单对象建模,请参考现在 定旅馆 的旅游网站,尽可能分析围绕订单发生的各种情况,直到订单通过销售事件(柜台销售)结束订单。 2)研究淘宝退货流程活动图,对退货业务对象状态建模...

2018-05-03 17:45:10 194

原创 系统分析与设计HW5

系统分析与设计HW51、 领域建模a. 阅读 Asg_RH 文档,按用例构建领域模型。 按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸 b. 数据库建模(E-R 模型) 按 Task 3 要求,给出系统的 E-R 模型(数据逻辑模型) 使用工具MYSQLWorkbanch来进行绘制。 数据库脚本-- MySQL Script generated by

2018-04-29 20:58:37 154

原创 系统分析与设计HW4

系统分析与设计HW41、 用例建模阅读 Asg_RH 文档,绘制用例图。 选择你熟悉的定旅馆在线服务系统(或移动 APP),绘制用例图。 这里我选择去哪儿网来绘制用例图 对比两个时代、不同地区产品的用例图,总结在项目早期,发现创新的思路与方法。 在项目早期,各个需求变化的可能性比较大,也是比较容易进行创新的时期,在这个时期应该多对市场进行调查,多调查用户的需求,对于同类产品做...

2018-04-21 14:13:48 194

空空如也

空空如也

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

TA关注的人

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