自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 python六大标准数据类型的介绍

python是一门热门的编程语言,也是一门热门的脚本语言,python中的六大标准类型分别为:数字、字符串、列表、元组、集合、字典。接下来我为大家介绍一下这六大类型:1、数字(1)数字的类型:整型(int)、浮点型(float)、复数(complex)      整型:通常称为整数,是整数或者负数,不带小数点。python3整型类型没有大小限制。      浮点型:浮点型由整数部分...

2018-08-04 16:43:10 4727

原创 A*算法的简单运用

1、 Problem DescriptionThis is a problem that is prominently featured in the lm Die Hard With a Vengeance. You have a3-gallon and a 5-gallon jug that you can ll from a fountain of water. The proble

2017-09-24 23:53:51 453

原创 C++希尔密码的实现以及运用

希尔密码(Hill Cipher)是运用基本矩阵论原理的替换密码,由Lester S. Hill在1929年发明。每个字母当作26进制数字:A=0, B=1, C=2... 一串字母当成n维向量,跟一个n×n的矩阵相乘,再将得出的结果mod26。注意用作加密的矩阵(即密匙)在\mathbb_^n必须是可逆的,否则就不可能译码。只有矩阵的行列式和26互质,才是可逆的。实验内容及要求

2017-09-21 19:19:05 5257

原创 算法概论课后习题8.8

设3SAT的实例I=(a1V a2V a3)(a4 V a5 V a6)...(.anV an+1V an+2)根据4SAT问题的条件,每个变量最多在每个子句中出现一次。如果某个变量在子句中出现多次,则缩减为1次。如果某个子句中同时包含互反的两个变量,则将这两个变量同时去除。接下来在各子句中添加1个变量,转化为4SAT。如(a1V a2V a3)转化为4SAT的实例(a1V

2017-07-11 20:33:41 259

原创 Palindrome Number

题目:Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Subscribe to see which companies asked this question.解析:這个题目极为简单,主要弄清什么是回文数即可,可以

2017-06-19 22:41:34 174

原创 Climbing Stairs

题目:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will

2017-06-19 22:35:38 176

原创 Unique Paths II

题目:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively

2017-06-13 15:29:19 175

原创 Unique Paths

A 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 down or right at any point in time. The robot is trying to reach the

2017-06-13 12:25:38 148

原创 Combinations

题目:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [

2017-05-23 12:24:40 122

原创 Majority Element

题目:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority

2017-05-15 00:15:04 162

原创 Best Time to Buy and Sell Stock with Cooldown

题目: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 as you like (i

2017-05-08 21:40:09 145

原创 二叉树

题目:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.

2017-05-01 18:40:14 139

原创 遍历二叉树

题目:Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2].Note: Recursi

2017-04-23 20:20:32 226

原创 Maximum Subarray

Problem:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray

2017-04-15 20:38:07 146

原创 递归(2)

题目:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the

2017-04-08 21:44:44 145

原创 递归

题目:Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be

2017-04-02 10:59:41 218

原创 巧妙解题

题目:Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memo

2017-03-25 16:32:02 220

原创 分治算法的运用

题目:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, ret

2017-03-19 00:33:24 205

原创 递归的运用

题目:Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations: [1,2,3] [1,3,2] [2,1,3] [2,3,1] [3,1,2] [3,2,1

2017-03-11 15:53:35 168

原创 罗马数字转换成阿拉伯数字以及递归的简单运用

继上周的阿拉伯数字转换成罗马数字,顺便把罗马数字转阿拉伯数字的也编写一下。题目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.题目解析:这道题主要运用两个规则,其一当左边的罗马数字比右边的罗马数字大时,

2017-03-06 00:16:13 316

原创 阿拉伯数字转换成罗马数字

问题:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.问题分析:罗马数字有如下的符号代表:I(1),V(5),X(10),L(50),C(100),D(500),M(1000)罗马数字都有如下的计

2017-02-25 19:18:43 636

空空如也

空空如也

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

TA关注的人

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