- 博客(55)
- 收藏
- 关注
原创 第一阶段检查效果
第一阶段检查效果1.检查ANT、Junit。主要是通过检查HelloWorld是否通过编译,部署和测试。(检查点:1.是否使用ANT;2.是否使用Junit) 2.检测SonarQube的使用情况。(SonarQube是否正常运行,Java小程序的分析结果) SonarQube正常运行: Java小程序的分析结果:(本图的sonar只是参考页面,尽可能修改到no error) ...
2018-04-15 00:49:40 330
原创 Leetcode:241. Different Ways to Add Parentheses
Description解题思路本题为分治算法问题,题意为给定一串数字和操作符,进行计算,返回所有可能结果。代码如下class Solution {public: vector<int> diffWaysToCompute(string input) { vector<int> result; int size = input.size();
2018-01-09 14:36:35 217
原创 Leetcode:375. Guess Number Higher or Lower II
DescriptionWe are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I’ll tell you whether the number I pick
2018-01-09 14:15:29 286
原创 Leetcode:464. Can I Win
DescriptionIn the “100 game,” two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins.What if we change
2018-01-07 00:45:10 442
原创 Leetcode:486. Predict the Winner
DescriptionGiven an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a play
2018-01-03 13:54:06 200
原创 Leetcode:329. Longest Increasing Path in a Matrix
Description解题思路拓扑排序题,但用DFS算法更为简单class Solution {public: int DFS(vectorvectorint>>& matrix, int y, int x, int val, vectorvectorint>>& hash) { if(y 0 || y >= matrix.size() || x
2018-01-03 13:31:37 159
原创 Leetcode:210. Course Schedule II
DescriptionThere are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expr
2018-01-03 13:24:17 198
原创 算法分析与设计:NP完全问题
8.12 The k-SPANNING TREE problem is the following.Input: An undirected graph G=(V,E) Output:A spanning tree of G in which each node has degree <= k,if such a tree exits. Show that for any k>= 2: (a)
2017-12-31 20:07:55 990
原创 Leetcode:100. Same Tree
Description解题思路采用DFS递归式的查找比较,若有一个不相等则返回false/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x)
2017-12-25 23:52:46 160
原创 Leetcode:690. Employee Importance
DescriptionYou are given a data structure of employee information, which includes the employee’s unique id, his importance value and his direct subordinates’ id.For example, employee 1 is the leader of
2017-12-24 22:25:21 197
原创 Leetcode:17. Letter Combinations of a Phone Number
Description解题思路1.DFSclass Solution {public: vector<string> letterCombinations(string digits) { vector<string> result; string save; if (digits.size() == 0) return vector<str
2017-12-18 22:51:12 182
原创 Leetcode:Longest Common Prefix
DescriptionWrite a function to find the longest common prefix string amongst an array of strings.找到一个字符串数组中的最长公共前缀,遍历每个字符串数组,比较两个相邻的字符串前缀是否相同,若相同则加入prefix中,若不相同则返回prefix,代码如下class Solution {public:
2017-12-18 22:26:44 173
原创 Leetcode: 698. Partition to K Equal Sum Subsets
DescriptionGiven an array of integers nums and a positive integer k, find whether it’s possible to divide this array into k non-empty subsets whose sums are all equal.Example 1: Input: nums = [4,
2017-12-13 15:14:52 315
原创 Leetcode: 64. Minimum Path Sum
DescriptionGiven a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or ri
2017-12-13 14:18:47 140
原创 Leetcode:714. Best Time to Buy and Sell Stock with Transaction Fee
DescriptionYour are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may complete
2017-12-13 14:02:46 384
原创 Leetcode:718. Maximum Length of Repeated Subarray
DescriptionGiven two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4,7] Output: 3 Explanation: The repea
2017-12-10 16:49:52 172
原创 Leetcode:740. Delete and Earn
Description解题思路挑选任意一个数字nums[i],得到nums[i]分,同时需要删除所有等于nums[i] - 1和nums[i] + 1的整数。求最大得分。用动态规划(Dynamic Programming)求解 dp[x]表示删除不大于x的所有数字的最大得分。c[x]存储数字x的个数。 状态转移方程: dp[x] = max(dp[x - 1], dp[x - 2] + c[x
2017-12-10 16:31:14 1283
原创 Leetcode:6. ZigZag Conversion
Description解题思路本题就利用一个字符串数组,每行一个字符串,每个字符串循环加入字符,最后将四个字符串累加到一个字符串中,返回结果。class Solution {public: string convert(string s, int numRows) { if (numRows <= 1) return s; int len = s.lengt
2017-12-09 22:49:01 147
原创 Leetcode:5. Longest Palindromic Substring
Description: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
2017-12-09 22:00:59 146
原创 Leetcode:70. Climbing Stairs
DescriptionYou 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 po
2017-12-05 11:26:50 132
原创 Leetcode:121. Best Time to Buy and Sell Stock
Description: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
2017-12-02 23:51:23 119
原创 Leetcode:226. Invert Binary Tree
Description:Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9to 4 / \ 7 2 / \ / \ 9 6 3 1解题思路递归算法: 1、交换根节点的左右子树。 2、对左右子树分别执行递归
2017-11-20 22:44:28 138
原创 Leetcode:240. Search a 2D Matrix II (week 11)
DescriptionWrite 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
2017-11-19 21:39:44 122
原创 Leetcode:23. Merge k Sorted Lists (week 10)
DescriptionMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 解题思路利用分治的思想把合并k个链表分成两个合并k/2个链表的任务,一直划分,知道任务中只剩一个链表或者两个链表。可以很简单的用递归来实现。因此算法复杂度为T(k) = 2T(k/2
2017-11-11 14:34:56 173
原创 Leetcode:215. Kth Largest Element in an Array (week 10)
DescriptionFind 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, r
2017-11-11 14:15:41 129
原创 Leetcode:435. Non-overlapping Intervals (week 9)
Description:Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping. Note: You may assume the interval’s end point
2017-11-04 14:18:10 137
原创 Leetcode:198. House Robber(week 9)
Description: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 adj
2017-11-01 13:53:07 154
原创 Leetcode:303. Range Sum Query - Immutable(week 8)
Description:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example: Given nums = [-2, 0, 3, -5, 2, -1] sumRange(0, 2) -> 1 sumRange(2, 5) -
2017-10-28 19:57:36 146
原创 Leetcode:402. Remove K Digits (Week 7)
Description:Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The length of num is less than 10002 and
2017-10-16 13:50:49 186
原创 Leetcode:455. Assign Cookies (week 7)
Description:Assume 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 si
2017-10-16 13:08:17 158
原创 Leetcode:657. Judge Route Circle (week 7)
Description:Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place. The move sequence is re
2017-10-16 12:52:51 133
原创 数字图像处理之直方图均衡化与匹配算法
本文为原创,有很多不足之处望斧正!实验内容一实现river.jpg 图像的直方图均衡,不能直接使用Matlab的histeq( )函数。将有关均衡图像和调用histeq( )函数的结果作比较。实验原理及算法描述直方图均衡化是通过把原图像的直方图经过变换函数修正为分布比较均匀的直方图,从而改变图像整体偏亮或偏暗,提高细节的对比度和辨识力,改善灰度层次不丰富的情况的技术。直方图均衡化过程解析:设r和s分
2017-10-14 19:59:36 4278
原创 Leetcode:2. Add Two Numbers(Week 6)
Description: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 a
2017-10-14 19:13:47 140
原创 Leetcode: 654. Maximum Binary Tree
Description: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 array. The left subtree is the maximum tree cons
2017-10-10 10:27:51 185
原创 Leetcode:493. Reverse Pairs
Description:Given an array nums, we call (i, j) an important reverse pair if i < j and nums[i] > 2*nums[j].You need to return the number of important reverse pairs in the given array. Example1: Inp
2017-10-08 23:25:16 404
原创 Leetcode:Median of Two Sorted Arrays
Description: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:
2017-10-01 20:41:52 131
原创 Leetcode: Course Schedule
Description:There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is exp
2017-09-23 20:16:30 142
原创 Leecode:Longest Substring Without Repeating Characters
class Solution {public: int lengthOfLongestSubstring(string s) { int maxlen = 0, flag = -1; int count = 0; int length = s.length(); if (length == 1) return true;
2017-09-20 21:23:36 153
原创 Android studio安装详解(Windows)
目录 1、AS(Android studio)的安装 2、下载SDK 3、安装时遇到的问题 4、创建一个helloworld项目,并在真机上测试1、AS 的安装 可能出现的问题:由于GWF,在工具栏打开SDK Manager可能无法更新下载。点击SDK Manager,未显示可下载更新项(如下图,显示的都是已安装的)。 点击SDK Update Sites,
2017-09-14 23:58:21 343
原创 Leetcode:169. Majority Element
Description: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 e
2017-09-14 22:31:03 160
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人