自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

nevermorezjh的专栏

怒水一发

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

原创 总结一下刷过的题

今年刷题还是挺爽的 1. Two Sum 用map建立number->index映射即可。2. Add Two Numbers 利用链表的基本操作来模拟高精度相加过程,链表头为最低位3. Longest Substring Without Repeating Characters 贪心,从头开始扫,遇到重复了,若上一个位置为i,则将i之前的字母去掉,继续贪心即可。4. Median of T

2017-01-05 15:44:45 4802

原创 算法概论8.20题解

首先证明这是一个NP问题:因为对于 DD,其中只是一系列点的集合,所以我们可以直接在多项式时间内验证它是不是一个占优集,即直接检查 DD 的规模是否满足预算,并标记 DD 中每一个点及其邻居,检查是否能覆盖所有的顶点。因此,这是一个 NP 问题然后,从顶点覆盖问题规约,来证明它是NP-完全的。Let G = (V, E) be an instance of the vertex cover pro

2016-11-27 10:29:46 450

原创 Leetcode (372) Super Pow

Your task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array. Example1: a = 2 b = [3] Result: 8 Ex

2016-11-17 00:00:41 215

原创 Leetcode (44) Wildcard Matching

题目 Implement wildcard pattern matching with support for ‘?’ and ‘*’. ‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence). The matching

2016-11-16 00:09:34 214

原创 Leetcode (397) Integer Replacement

题目: Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2. If n is odd, you can replace n with either n + 1 or n - 1. What is the minimum number

2016-11-11 23:44:41 249

原创 Leetcode (212) Word Search II

题目: Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjacent cell, where “adjacent” cells are th

2016-11-06 15:39:28 264

原创 Leetcode (135) Candy

题目 There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements: Each child must have at l

2016-11-02 21:28:37 241

原创 Leetcode (316) Remove Duplicate Letters

题目:Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical orde

2016-11-02 10:45:09 212

原创 Leetcode (410) Split Array Largest Sum

题目: Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest sum among these

2016-10-24 22:37:27 332

原创 Leetcode (403) Frog Jump

题目: A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water. Given a

2016-10-24 16:22:48 241

原创 Leetcode (85) Maximal Rectangle

题目: Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1

2016-10-19 11:52:50 366

原创 Leetcode (330) Patching Array

题目 Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive can be formed by the sum of some elements in the array. R

2016-10-18 23:29:43 190

原创 Leetcode (45) Jump Game II

题目: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Yo

2016-10-17 16:38:06 217

原创 Leetcode (295) Find Median from Data Stream

Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. Examples: [2,3,4] , the med

2016-10-10 23:36:46 196

原创 Leetcode (37) Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character ‘.’. You may assume that there will be only one unique solution.题意:求解数独游戏,给定的bo

2016-10-10 22:58:54 253

原创 Leetcode (322) Coin Change

You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money c

2016-09-26 16:15:16 253

原创 Leetcode (287) Find the Duplicate Number

Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, fin

2016-09-23 23:17:22 286

原创 Leetcode (29) Divide Two Integers

题目 Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT.题意:不使用乘法,除法,模运算,完成除法思路:不使用乘法、除法、模运算,即剩下加法、减法、位运算加法减法的话,思路大约是将除法按照减法来算,逐个累积,进而得

2016-09-21 23:10:49 212

原创 Leetcode (307) Range Sum Query - Mutable

Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function modifies nums by updating the element at index i to val. Exampl

2016-09-19 16:55:43 309

原创 Leetcode (72) Edit Distance

Leetcode (72) Edit Distance Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have the following 3

2016-09-12 17:06:01 271

原创 Leetcode (312) Burst Balloons

Leetcode (312) Burst Balloons Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you bu

2016-09-11 11:04:46 559

原创 Leetcode (41) First Missing Positive

Leetcode (41) First Missing Positive Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2. Your algor

2016-09-06 14:11:01 304 2

空空如也

空空如也

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

TA关注的人

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