自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 【leetcode】3. Longest Substring Without Repeating Characters

c++:class Solution {public: int lengthOfLongestSubstring(string s) { vector dict(256, -1); int maxLen = 0, start = -1; for (int i = 0; i != s.length(); i++) {

2018-01-13 22:37:38 193

原创 算法概论Chapter 8 :p20

Answer: 可以将顶点覆盖问题归约到支配集问题。若要在图 ( ) , GVE中求得不大于b 的一个 顶点覆盖,可以先对图G 做一个预处理:对每条边( ) , u v E ∈ ,添加一个辅助顶点w, 及两条边() , uw和( ) , vw,如下图所示: 对每条边都这样处理后得到一个新图 ’ G 。容易看出,若原图G 中存在不大于b 的 顶点覆盖,这个顶点覆盖也是新图 ’ G 的一个支配集。

2018-01-01 20:37:10 321

原创 Web安全:实验4-FTP协议分析实验

警示:实验报告如有雷同,雷同各方当次实验成绩均以0分计;在规定时间内未上交实验报告的,不得以其他方式补交,当次成绩按0分计;实验报告文件以PDF格式提交。 院系数据科学与计算机学院班级15级4班学号15331145姓名李果完成日期:  2017年  12  月  25

2017-12-26 20:38:37 6092

原创 Web安全:实验1-网络扫描实验

警示:实验报告如有雷同,雷同各方当次实验成绩均以0分计;在规定时间内未上交实验报告的,不得以其他方式补交,当次成绩按0分计;实验报告文件以PDF格式提交。 院系数据科学与计算机学院班级15级4班学号15331145姓名李果完成日期:  2017年  12  月   3

2017-12-26 20:18:56 6970 1

原创 Leetcode: 621. Task Scheduler

题目大意: 给定一些任务以及一个整数时隙n,26种从A~Z。CPU每个时隙可以处理一个任务,处理一个任务后需要经过n时隙后才能处理一个相同的任务,但是这n个时隙可以利用起来处理别的任务。给出最少时隙。c++code:class Solution {public: int leastInterval(vector<char>& tasks, int n) { vec

2017-12-26 20:17:13 234

原创 Leetcode:741. Cherry Pickup

c++code:class Solution {public:int cherryPickup(vector<vector<int>>& grid) { int n = grid.size(); int maxK = 2 * n - 1; int dp[maxK][n][n] = {-1}; memset(dp, -1, sizeof(dp)); for(

2017-12-10 22:53:36 598

原创 Leetcode:714. Best Time to Buy and Sell Stock with Transaction Fee

c++:class Solution {public: int maxProfit(vector<int>& prices, int fee) { int len = prices.size(); vector<int> maxProfit(len), cashWhenHoldOne(len); maxProfit[0] = 0, cashW

2017-12-10 22:52:20 154

原创 Leetcode:523. Continuous Subarray Sum

c++code:class Solution { public: bool checkSubarraySum(vector<int>& nums, int k) { unordered_map<int, int> hash; int sum = 0; hash[0] = -1; for(int i=0; i

2017-12-10 22:50:24 202

原创 Leetcode:467. Unique Substrings in Wraparound String

c++code:class Solution {public: int findSubstringInWraproundString(string p) { vector<int> cnt(26, 0); int len = 0; for (int i = 0; i < p.size(); ++i) { if (i >

2017-12-10 22:49:11 132

原创 Leetcode: 664. Strange Printer

This problem is simiiar to #546(Leetcode) Remove Boxes which uses f[l][r][k] to store the maximum points of range [l, r] with k boxes equal to r. But for this problem, we can use 2D-array DP instead of

2017-11-14 20:56:43 223

原创 Leetcode: 650. 2 Keys Keyboard

c++:class Solution {public: int minSteps(int n) { if (n == 1) return 0; for (int i = 2; i < n; i++) if (n % i == 0) return i + minSteps(n / i); return n; }

2017-11-14 20:53:06 126

原创 Leetcode: 712. Minimum ASCII Delete Sum for Two Strings

c++(O(n)):class Solution {public: int minimumDeleteSum(string s1, string s2) { int m = s1.size(), n = s2.size(); vector<int> dp(n+1, 0); for (int j = 1; j <= n; j++)

2017-11-14 20:51:12 155

原创 Leetcode: 300. Longest Increasing Subsequence

c++ code:class Solution {public: int lengthOfLIS(vector<int>& nums) { vector<int> dp(nums.size(), 1); int ans = 0; for (int i = 0; i < nums.size(); ++i) { for (

2017-11-05 20:22:53 124

原创 X.509数据结构,实例分析与使用

X.509被广泛使用的数字证书标准,是由国际电联电信委员会(ITU-T)为单点登录(SSO-Single Sign-on)和授权管理基础设施 (PMI-Privilege Management Infrastructure)制定的PKI标准,其中,单点登录指的是用户只需要登录一次就可以访问所有相互信任的应用系统,PKI标准指的是为支持公开密钥管理并能支持认证、加密、完整性和可追究性服务的基础设施。

2017-11-02 12:16:25 433

原创 Md5算法代码(c++):

c++code:#include <iostream>#include "math.h"#include <cstring>#include <vector>#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))#define H(x, y, z) ((x)

2017-11-02 12:10:34 305

原创 DES 算法:

算法原理概述: 简介: DES算法为密码体制中的对称密码体制,又被称为美国数据加密标准。总体结构: –置换IP与逆置换IP-模块分解: 以下图为例: 分解模块从对整个过程而言,分为: 对应于下文代码中的 Ip()函数; 迭代过程主要是Feistel轮函数f(Ri-1, Ki),对应于下文代码中的Mul_trans()函数。其中异或L16以及R16过程为L_R()函数。值得一

2017-11-02 12:07:57 269

原创 Leetcode: 402. Remove K Digits

c++代码:class Solution {public: string removeKdigits(string num, int k) { string ANS; int keep = num.size() - k; for (int i=0; i<num.size(); i++) {

2017-10-29 23:51:26 211

原创 [Leetcode]516. Longest Palindromic Subsequence

c++代码:class Solution {public: int longestPalindromeSubseq(string s) { int n = s.size(); int dp[n][n] = {0}; for (int i = n - 1; i >= 0; --i) { dp[i][i] = 1;

2017-10-25 22:23:05 177

原创 Leetcode:378. Kth Smallest Element in a Sorted Matrix

算法:使用nth_number()函数class Solution {public: int kthSmallest(vector<vector<int>>& matrix, int k) { int row=matrix.size(); int col=matrix[0].size(); int* number = new int[

2017-10-14 21:00:56 203

原创 Leetcode: 454. 4Sum II

算法:先将AB的所有组合计算出来存进map中,然后在与所有的CD组合在map中使用count;class Solution {public: int fourSumCount(vector<int>& A, vector<int>& B, vector<int>& C, vector<int>& D) { std::map<int, int> map; in

2017-10-14 20:48:11 206

原创 Leetcode:215. Kth Largest Element in an Array

题意:即相当于第n - k +1大的数!下面放出代码:class Solution {public: int findKthLargest(vector<int>& nums, int k) { int L = 0, R = nums.size() - 1; while (L < R) { int left = L, right =

2017-10-04 20:35:23 146

原创 LeetCode:48. Rotate Image

代码如下:class Solution {public: void rotate(vector<vector<int>>& matrix) { vector<vector<int> > temp(matrix.size(), vector<int>(matrix.size())); temp

2017-09-24 19:49:48 148

原创 Leetcode: 50 Pow(x,n)

题意:即求实数x的n次幂。 先将解题代码放出:class Solution {public: double myPow(double x, int n) { if( n == 0) return 1.00000; double z = x - 0 > 0 ? x : -x; if(z - 1 > 0 && n < -1

2017-09-17 22:33:01 179

原创 Leetcode :2 Add Two Numbers

LEETCODE: 题意理解:也就是给定两个非空链表,然后按照十进制加法处理这两个链表并存入一个新链表中。先将解题代码放上:class Solution {public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { ListNode* l3; ListNode* old; bo

2017-09-10 19:32:50 151

空空如也

空空如也

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

TA关注的人

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