自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Howie66的博客

To be a life-long learner!

  • 博客(395)
  • 资源 (2)
  • 收藏
  • 关注

原创 顺序表应用8:最大子段和之动态规划法

Problem Description 给定n(1<=n<=100000)个整数(可能为负数)组成的序列a[1],a[2],a[3],…,a[n],求该序列如a[i]+a[i+1]+…+a[j]的子段和的最大值。当所给的整数均为负数时定义子段和为0,依此定义,所求的最优值为: Max{0,a[i]+a[i+1]+…+a[j]},1<=i<=j<=n。 例如,当(a...

2019-01-26 20:51:59 427

原创 顺序表应用3:元素位置互换之移位算法

Problem Description一个长度为len(1<=len<=1000000)的顺序表,数据元素的类型为整型,将该表分成两半,前一半有m个元素,后一半有len-m个元素(1<=m<=len),借助元素移位的方式,设计一个空间复杂度为O(1)的算法,改变原来的顺序表,把顺序表中原来在前的m个元素放到表的后段,后len-m个元素放到表的前段。注意:先将顺序表元素...

2019-01-25 11:36:41 432

原创 顺序表应用1:多余元素删除之移位算法

 Problem Description一个长度不超过10000数据的顺序表,可能存在着一些值相同的“多余”数据元素(类型为整型),编写一个程序将“多余”的数据元素从顺序表中删除,使该表由一个“非纯表”(值相同的元素在表中可能有多个)变成一个“纯表”(值相同的元素在表中只保留第一个)。要求:       1、必须先定义线性表的结构与操作函数,在主函数中借助该定义与操作函数调用实现问题功...

2019-01-25 09:36:23 488

原创 Leetcode周赛119

已经累计打了10几场比赛了,之前忘记总结了,就从这一场开始总结吧。本次比赛做出来2/4,前两个题,第三个题没想出思路,排名1700/3400,话说那些大佬真的是厉害,本次有400+大佬ak,强啊,最快的那个大佬在我刚做完第一题的时候就已经ak了,emmmmmm。第一个:Squares of a Sorted Array(这个题相当简单,就是简单的做一个运算之后排个序就行了)Given ...

2019-01-20 12:52:50 433

原创 Leetcode 967 Numbers With Same Consecutive Differences

Return all non-negative integers of length N such that the absolute difference between every two consecutive digits is K.Note that every number in the answer must not have leading zeros except for t...

2018-12-30 16:48:51 503

原创 Leetcode 68 Text Justification

Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.You should pack your words in a greedy appro...

2018-12-23 10:26:49 253

原创 Leetcode 71 Simplify Path

Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"path = "/a/../../b/../c//.//", => "/c"pa

2018-12-23 10:01:01 240

原创 Leetcode 481 Magical String

A magical string S consists of only '1' and '2' and obeys the following rules:The string S is magical because concatenating the number of contiguous occurrences of characters '1' and '2' generates t...

2018-12-23 09:38:45 297

原创 Leetcode 299 Bulls and Cows

题目:You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint...

2018-12-15 21:43:51 222

原创 Leetcode 231 Power of Two

Given an integer, write a function to determine if it is a power of two.Example 1:Input: 1Output: true Explanation: 20 = 1Example 2:Input: 16Output: trueExplanation: 24 = 16Example 3:...

2018-12-10 12:15:25 204

原创 Leetcode 42 Trapping Rain Water

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above elevation map is represented by array...

2018-11-23 15:18:57 195

原创 Leetcode 41 First Missing Positive

Given an unsorted integer array, find the smallest missing positive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Example 3:Input: [7,8,9,11,12]Outpu...

2018-11-19 20:47:55 213

原创 Leetcode 40 Combination Sum II

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.Each number in candidates may...

2018-11-12 10:58:33 244

原创 Leetcode 39 Combination Sum

Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.The same repeat...

2018-11-12 10:54:58 216

原创 Leetcode 38 Count and Say

The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11.11 is read off ...

2018-11-09 10:51:35 232

原创 Tomcat代码实现

最近开课学到了Tomcat,对这个挺感兴趣,就跟着网上的教程自己实现了一遍。众所周知,Tomcat是一个满足Servlet规范的容器,在Java Web的项目中大量使用;一般来说,我们需要将Web应用打包成War文件部署到Tomcat服务器中,通过制定映射关系来制定路径,指明被哪个方法处理。Tomcat对于实际的请求会做出以下的操作:提供Socket服务,不过是支持HTTP的Socket进...

2018-11-08 23:28:13 471

原创 Leetcode 37 Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells.A sudoku solution must satisfy all of the following rules:Each of the digits 1-9 must occur exactly once in each row. Each of t...

2018-11-06 21:01:57 244

原创 Leetcode 36 Valid Sudoku

Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:Each row must contain the digits 1-9 without repetition. Each column must conta...

2018-11-06 20:59:41 207

原创 Leetcode 935 Knight Dialer

A chess knight can move as indicated in the chess diagram below: .            This time, we place our chess knight on any numbered key of a phone pad (indicated above), and the knight makes N-1 ...

2018-11-04 15:49:31 658

原创 Leetcode 933 Number of Recent Calls

Write a class RecentCounter to count recent requests.It has only one method: ping(int t), where t represents some time in milliseconds.Return the number of pings that have been made from 3000 mill...

2018-11-04 11:54:36 674

原创 Leetcode 35 Search Insert Position

Example 1:Input: [1,3,5,6], 5Output: 2Example 2:Input: [1,3,5,6], 2Output: 1Example 3:Input: [1,3,5,6], 7Output: 4Example 4:Input: [1,3,5,6], 0Output: 0这个题目的意思是找到target在数组中应...

2018-11-01 20:07:20 179

原创 Leetcode 34 Find First and Last Position of Element in Sorted Array

Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the...

2018-10-31 16:21:09 207

原创 Leetcode 33 Search in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).You are given a target value to search. If found ...

2018-10-30 09:53:03 160

原创 Leetcode 32 Longest Valid Parentheses

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: "(()"Output: 2Explanation: The longest valid...

2018-10-29 16:49:09 179

原创 Leetcode 31 Next Permutation

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible o...

2018-10-28 11:38:24 188

原创 Leetcode 30 Substring with Concatenation of All Words

You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and wi...

2018-10-27 17:33:03 186

原创 Leetcode 29 Divide Two Integers

Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividing dividend by divisor.The integer division sho...

2018-10-26 20:22:24 199

原创 Leetcode 28 Implement strStr()

Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2Example...

2018-10-25 15:47:42 200

原创 反转链表(递归与栈)

输入一个链表,反转链表后,输出新链表的表头。1)使用一个栈来实现:/*public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; }}*/import java.util.*;public class So...

2018-10-24 15:09:58 758

原创 Leetcode 27 Remove-Element

Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length.这个题的题...

2018-10-24 14:16:52 180

原创 Leetcode 26 Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only onceand return the new length.Do not allocate extra space for another array, you must do this in place with co...

2018-10-23 18:44:01 226

原创 Leetcode 25 Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the number of ...

2018-10-21 10:59:54 185

原创 Leetcode 24 Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head.Example:Given 1->2->3->4, you should return the list as 2->1->4->3Note:Your algorithm should use only ...

2018-10-20 10:05:57 124

原创 Leetcode 23 Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[  1->4->5,  1->3->4,  2->6]Output: 1->1->2->3->4-...

2018-10-19 13:49:03 246

原创 字母统计(数组思维)

输入一行字符串,计算其中A-Z大写字母出现的次数 输入描述:案例可能有多组,每个案例输入为一行字符串。输出描述:对每个案例按A-Z的顺序输出其中大写字母出现的次数。示例1输入DFJEIWFNQLEF0395823048+_+JDLSFJDLSJFKK输出A:0B:0C:0D:3E:2F:5G:0H:0I:1J:4K:2L:3M...

2018-10-18 21:46:52 298

原创 Leetcode 22 Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())"...

2018-10-18 21:43:57 137

原创 牛牛打响指(大数)

牛牛在地上捡到了一个手套,他带上手套发现眼前出现了很多个小人,当他打一下响指,这些小人的数量就会发生以下变化:如果小人原本的数量是偶数那么数量就会变成一半,如果小人原本的数量是奇数那么数量就会加一。现在牛牛想考考你,他要打多少次响指,才能让小人的数量变成1。 输入描述:每个输入包含一个测试用例。输入的第一行包括一个正整数,表示一开始小人的数量N(1<=N<=10^100)。...

2018-10-17 20:00:32 432

原创 Leetcode 21 Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1-...

2018-10-17 15:34:27 144

原创 Leetcode 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 of b...

2018-10-16 19:35:51 152

原创 牛牛偶像养成记(贪心)

  为了拯救因入学人数骤降,面临废弃的学校,牛牛决定成为偶像啦。当然,作为一个偶像,肯定是要上台表演的。已知牛牛拿到了n个上台表演的机会,第i次表演的上台时间为ti时刻,需要表演mi这么长的时间。牛牛为了提高自己的知名度,肯定要取得最多的上场次数。请问,牛牛最多能上场多少次呢?输入描述:第一行输入一个数字n(1≤n≤100000),表示牛牛获得的上台表演的机会接下来n行...

2018-10-15 20:53:14 370

高数下册.md

自己总结的一点高数的思维导图,高数下册:该书分上、下两册出版,上册包括函数与极限、导数与微分、微分中值定理与导数的应用、不定积分、定积分及其应用、微分方程等内容 [1] ;下册包括空间解析几何与向量代数、多元函数微分法及其应用、重积分、曲线积分与曲面积分、无穷级数等内容 [2] 。

2019-06-26

算法设计指南

《算法设计指南》由算法领域的知名专家Steven Skiena教授编写, 其主要内容包括基本算法设计、算法分析、数据结构、排序与查找、图算法、动态规划以及难解问题与近似算法. Skiena教授荣获了IEEE计算机科学与工程教学奖, 这本书则是其教学理念的最好展现. 该书长期居于算法畅销教材前列, 是一本不可多得的“算法设计指南”, 它不仅能作为计算机相关专业算法课程的教材, 对于相关领域从业人员亦是极具价值的参考书. 作者:算法时空 链接:https://www.jianshu.com/p/388c878c1285 來源:简书 简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

2019-02-19

空空如也

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

TA关注的人

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