自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 【系统分析与设计】作业二

作业二:

2018-03-19 23:21:28 247

原创 【系统分析与设计】作业一

一、简答题Q1. 软件工程的定义定义一: (1)将系统化、规范化、可度量的方法应用与软件的开发、运行和维护的过程,即将工程化应用于软件中。(2) 对(1)中所述方法的研究。 —— IEEE定义二: 是指导计算机软件开发和维护的工程学科。 采用工程的概念、 原理、 技术和方法来开发与维护软件, 把经过实践考验而证明正确的管理技术和当前能够得到的最好的技术方法结合起来...

2018-03-13 21:12:04 253

转载 309. Best Time to Buy and Sell Stock with Cooldown

题目 class Solution {public: int maxProfit(vectorint>& prices) { int buy = INT_MIN; int pre_buy; int sell = 0; int pre_sell = 0; for (int i = 0; i < pri

2018-01-11 16:24:22 165

原创 238. Product of Array Except Self

题目 discussion中的解答:class Solution {public: vectorint> productExceptSelf(vectorint>& nums) { vectorint> left(nums.size(), 1); vectorint> right(nums.size(), 1); vect

2018-01-11 14:13:29 188

原创 55. Jump Game

98 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 contains only nodes with keys less than the node’s key.

2018-01-10 22:12:53 130

转载 48. Rotate Image

You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note: You have to rotate the image in-place, which means you have to modify the input 2D matrix d

2018-01-09 20:59:04 124

原创 46. Permutations

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

2018-01-09 20:51:00 133

原创 11. Container With Most Water

19 Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the lin

2018-01-08 11:38:47 135

原创 11. Container With Most Water

哦?markdown编辑器更新了?啥玩意? 不管不管,完成作业要紧。题目leetcode 11Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two e

2018-01-07 22:23:40 130

原创 《算法概论》chapter8 NP完全问题

部分题目解答:8.8题目:The EXACT 4SAT problem, the input is a set of clauses, which is a disjunction of exactly four literals, and such that each variable occurs at most once in each clause. The goal is to find

2017-12-31 22:10:15 362

原创 4. Median of Two Sorted Arrays

题目题目链接 There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1: nums1 = [1,

2017-12-21 13:59:29 138

原创 5. Longest Palindromic Substring

问题Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: “babad”Output: “bab”Note: “aba” is also a valid answer. Example:Inpu

2017-12-18 18:31:02 129

原创 3. Longest Substring Without Repeating Characters

description:leetcode算法第三题 Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the

2017-12-17 23:18:59 116

原创 编译原理_词法分析程序设计

题目: 代码:我是把所有的代码内容输入完毕后再进行分析的。有find函数#include<string>#include<iostream>#include<vector>using namespace std;vector<string> integer; //保存无符号整数 vector<string> identifier; //保存标识符 vector<string> tex

2017-12-17 21:34:23 804

原创 2. Add Two Numbers

题目You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return

2017-12-08 23:26:47 127

原创 474. Ones and Zeroes

题目:In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue.For now, suppose you are a dominator of m 0s and n 1s respectively. On the other

2017-12-03 11:04:09 165

原创 算法期中1007. 怪兽训练 (找出有向图中所有的强连通分量的Kosaraju算法)

Description贝爷的人生乐趣之一就是约战马会长. 他知道马会长喜欢和怪兽对决,于是他训练了N只怪兽,并对怪兽用0到N-1的整数进行编号. 贝爷训练怪兽的方式是让它们一对一互殴. 两只怪兽互殴会发生以下三种可能的结果: 1) 什么事也没发生 2) 第一只怪兽永远消失 3) 第二只怪兽永远消失 怪兽们经过了旷日持久的互殴. 贝爷不知道哪些怪兽进行了互殴也不知道它们互殴的顺序,但他确

2017-11-27 21:36:28 962 4

原创 647. Palindromic Substrings

题目:Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even they consist

2017-11-27 17:28:46 151

原创 动态生成数组和vector

总结下,每次打码都要查…C++中的vector一维vector:vector<int> ivec; //定义向量对象 ivecvector<int> ivec1(ivec); // 定义向量对象ivec1,并用ivec初始化vector<int> ivec2(n,1); //定义向量ivec2,包含了n个值为1的元素vector<int> ivec

2017-11-17 21:57:34 726

原创 算法期中1004. 拓扑序[Special judge]

Description在图论中,拓扑序(Topological Sorting)是一个有向无环图(DAG, Directed Acyclic Graph)的所有顶点的线性序列. 且该序列必须满足下面两个条件:每个顶点出现且只出现一次.若存在一条从顶点 A 到顶点 B 的路径,那么在序列中顶点 A 出现在顶点 B 的前面.对于一个含有n个节点的有向无环图(节点编号0到n-1),输出

2017-11-17 21:28:55 379

原创 1006. 最长公共子串

未结束,还没理解清楚,溜去睡觉了。Description 给定两个字符串x = x­1x­2…x­n和y = y­1y­2…ym, 请找出x和y的最长公共子串的长度,也就是求出一个最大的k,使得存在下标i和j有x­ix­i+1…x­i+k-1 = yjy­j+1…y­j+k-1.x和y只含有小写字母,长度均在1和1000之间.请为下面的Solution类实现解决上述问题的函数longestSubs

2017-11-13 20:55:47 275

原创 算法期中1003. 最近的0

Description 输入一个N*M的01矩阵A,对矩阵的每个位置,求至少经过多少步可以到达一个0. 每一步可以往上下左右走一格.请为下面的Solution类实现解决这一问题的函数nearestZero,函数参数A为给出的01矩阵,A的行数和列数均不大于100. 函数的返回值是问题的答案.class Solution {public: vector<vector<int>>neares

2017-11-13 20:04:08 220

原创 算法期中1002. 合并二叉树

Description 输入两个二叉树T1和T2,要求对T1和T2进行合并. 合并是指将二叉树同一位置节点上的数求和,作为合并后二叉树相应位置节点的数值. 如果某个位置上只有一个二叉树有节点,则合并后的二叉树对应位置上的节点上的数值就等于这个节点上的数值.例如: T1 T2 1

2017-11-13 19:24:47 264

原创 算法期中1005. 最小和

Description 从数列A[0], A[1], A[2], …, A[N-1]中选若干个数,要求对于每个,i(i >= 0, i <=N - 1)A[i]和A[i+1]至少选一个数,求能选出的最小和.1 <= N <= 100000, 1 <= A[i] <= 1000请为下面的Solution类实现解决上述问题的函数minSum,函数参数A是给出的数列,返回值为所求的最小和.class S

2017-11-13 19:03:10 228

原创 算法期中1000. 分组

Description 对于一个整数数列A[0], A[1], …, A[N-1]进行分组,要求每组1到2个数,并且同组之和不能大于w. 求最少可以分成多少组.1 <= N <= 100000, 1 <= A[i] <= w <= 1000000000.请实现下面Solution类中计算minPartition(A, w)的函数.class Solution {public: i

2017-11-12 23:13:38 460

转载 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.For example, given n = 2, return 1

2017-11-10 23:41:30 136

原创 62. 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 botto

2017-11-08 01:19:01 155

原创 688. Knight Probability in Chessboard

https://leetcode.com/problems/knight-probability-in-chessboard/description/ On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and col

2017-11-04 22:53:42 282

原创 70. 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 be a positive inte

2017-11-02 23:42:37 140

转载 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 (ie, buy one and sell one share of the stock), desi

2017-11-02 00:34:05 147

原创 198. House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses

2017-10-31 23:50:47 139

原创 455.assign cookies

ssume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a cooki

2017-10-29 23:12:50 174

原创 406. Queue Reconstruction by Height

Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of this p

2017-10-20 00:37:22 193

原创 Add to List 392. Is Subsequence

Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, an

2017-10-15 22:49:28 165

原创 122. Best Time to Buy and Sell Stock II

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 (ie, buy one and

2017-10-15 22:10:11 159

原创 513. Find Bottom Left Tree Value

Given a binary tree, find the leftmost value in the last row of the tree.Example 1: Input: 2 / \1 3Output: 1 Example 2: Input: 1 / \ 2 3 / / \4 5 6 / 7Output: 7 Not

2017-10-06 17:03:54 199

原创 104. Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.回顾一下深度优先和广度优先吧使用递归的深度优先搜索(一行搞定)str

2017-10-06 16:24:53 189

原创 240. Search a 2D Matrix II

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Integers in

2017-09-27 00:51:22 194

原创 215. Kth Largest Element in an Array

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, return

2017-09-24 12:41:52 192

原创 241. Different Ways to Add Parentheses

241. Different Ways to Add ParenthesesGiven a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid opera

2017-09-12 15:43:41 154

空空如也

空空如也

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

TA关注的人

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