自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

北海的博客

心若北海-以容鲲鹏

  • 博客(37)
  • 收藏
  • 关注

原创 autoreconf 命令

在linux中通过拷贝文件安装软件,执行make 操作时出现如下问题Makefile:372: recipe for target 'aclocal.m4' failed解决办法:在linux终端下执行 :autoreconf -vfi通过拷贝来的源码,在配置文件中保留原来的配置,所以需要使用autoreconf来更新已经生成的配置文件

2017-09-19 16:21:30 17709 2

原创 95. Unique Binary Search Trees II

Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown below. 1

2017-09-18 20:12:15 368

原创 63. 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 in the

2017-09-18 10:15:33 423

原创 264. Ugly Number II

Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 

2017-09-14 21:41:55 217

原创 368. Largest Divisible Subset

Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0.If there are multiple solution

2017-09-14 20:35:58 196

原创 120. Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [

2017-09-13 22:12:15 145

原创 213. House Robber II

Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time

2017-09-13 20:24:15 309

原创 c中struct和unsigned char*强制互相转化。

今天看c代码的时候发现一个struct强制转换成char*的,然后在自己的sublime上怎么都会报错,即使没有报错,但是运行时也会奔溃。无奈使用牛逼烘烘的vs2017!!果然可以了,试了几个不同的操作。可以看到str转变后地址发生了变化,对str指向的对象操作的时候,结构体的数据也发生了改变。所以我们可以看到,在c中struct是以一整块连续的块放在内存中的,其中顺序和是

2017-09-13 18:32:30 4532

原创 vim记住上次打开位置

使用了centos7,换了几次配置文件后,vim竟然不能自动记住文件上次打开了。查了好多种方法就这个搞定了问题。在配置文件.vimrc或/etc/vimrc中加入下面两行。set viminfo='10,\"100,:20,%,n~/.viminfo au BufReadPost * if line("'\"") > 0|if line("'\"") 我的配置文件位置在/e

2017-09-13 15:06:11 6344

原创 376. Wiggle Subsequence

A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either pos

2017-09-12 20:10:34 203

原创 279. Perfect Squares

Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n =

2017-09-12 17:37:25 216

原创 300. Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101], ther

2017-09-11 22:36:00 151

原创 64. Minimum Path Sum

Given 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 right at

2017-09-11 21:44:45 162

原创 416. Partition Equal Subset Sum

Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note:Each of the array

2017-09-10 16:17:05 280 1

原创 309. 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 (ie, buy on

2017-09-10 13:47:11 197

原创 使我对动态规划的理解发生转折的算法的解决过程的思想变化的过程

事情发生在今天这个夜黑风高的夜晚。我遇到一道题目62. Unique PathsA 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

2017-09-09 00:46:45 242

原创 638. Shopping Offers

In LeetCode Store, there are some kinds of items to sell. Each item has a price.However, there are some special offers, and a special offer consists of one or more different kinds of items with a

2017-09-07 23:36:53 229

原创 650. 2 Keys Keyboard

Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step:Copy All: You can copy all the characters present on the notepad (partial c

2017-09-06 18:47:08 138

原创 646. Maximum Length of Pair Chain

You are given n pairs of numbers. In every pair, the first number is always smaller than the second number.Now, we define a pair (c, d) can follow another pair (a, b) if and only if b . Chain

2017-09-05 23:01:55 141

原创 647. Palindromic Substrings

647. Palindromic SubstringsGiven 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 diff

2017-09-05 21:57:48 127

原创 likely和unlikely函数

likely和unlikely函数今天看源码的时候遇到likely和unlikely两个函数,第一感觉是很困惑,1、都是在if的判断语句中,2、其中参数也都是简单的比大小等类型的判断语句,3、感觉没有likely和unlikely也可以判断,那么为啥非要加上一个“函数”呢?于是上网查明这个likely和unlikely快速了解:likely和unlikely分别表明了要判断

2017-09-05 17:06:38 2808

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

122. Best Time to Buy and Sell Stock IISay 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

2017-09-04 21:54:06 132

原创 455. Assign Cookies

455.Assign CookiesAssume 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 t

2017-09-04 21:19:21 118

原创 67. Add Binary

Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".简单方法,依次相加,若一个string加完还有进一,则对接下来的继续加class Solution {public: string addBina

2016-08-29 14:29:39 321

原创 387. First Unique Character in a String

Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.简单思路:两层遍历。class Solution {public: int firstUniqChar(string s) { int

2016-08-25 21:15:16 168

原创 14. Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.简单思路,先获得第一个字串,比较个字串,比较后的结果作为下次比较的输入。class Solution {public: string longestCommonPrefix(vector& strs) {

2016-08-25 20:37:18 183

原创 OpenSSL-SSL协议

一、OpenSSL简介OpenSSL是一个基于密码学的安全开发包,整个软件包大概可以分成三个主要的功能部分:SSL协议库、应用程序以及密码算法库。OpenSSL的目录结构自然也是围绕这三个功能部分进行规划的。OpenSSL提供的功能相当强大和全面,囊括了主要的密码算法、常用的密钥和证书封装管理功能以及SSL协议,并提供了丰富的应用程序供测试或其它目的使用。其核心是对SSL协议的实现。二

2016-08-25 16:56:24 1427

原创 190. Reverse Bits

Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110010

2016-08-25 12:49:23 272

原创 203. Remove Linked List Elements

Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5思路比较简单,直接遍历,删除就可以了。对于第一个

2016-08-25 11:33:41 209

原创 234. Palindrome Linked List

Given a singly linked list, determine if it is a palindrome.简单的使用栈,检测是否回文/** * Definition for singly-linked list. * struct ListNode { *     int val; *     ListNode *next; *     ListNode(

2016-08-24 17:18:28 171

原创 58. Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is

2016-08-24 10:36:51 164

原创 38. Count and Say

The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as 

2016-08-24 10:02:41 158

原创 20. Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va

2016-08-23 21:04:10 146

原创 290. Word Pattern

Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.

2016-08-23 19:16:28 161

原创 19. Remove Nth Node From End of List

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

2016-08-22 12:49:59 156

原创 88. Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold addit

2016-08-22 11:46:59 282

原创 获取图片颜色相同的最大块,获取二维数组中值上下左右连续相同的最大块

问题:查找一块图片中区域颜色相同的最大的一块,以二维数组模拟图片,共有1、2、3、4四种颜色。输入:一个二维数组,每个值为1、2、3、4中的一个。输出:最大块颜色值及最大块总数值。主要思路:参数设置:int a[10][10],作为被查找最大块的原始数据,数组里用1、2、3、4表示4种不同的颜色。为方便验证正确性,此处使用10*10的二位数组。int k,记录当前颜色。

2016-08-21 11:09:24 2383

空空如也

空空如也

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

TA关注的人

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