leetcode
文章平均质量分 64
nevermorezjh
这个作者很懒,什么都没留下…
展开
-
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 阅读 · 0 评论 -
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 · 222 阅读 · 0 评论 -
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 · 193 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 · 251 阅读 · 0 评论 -
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 · 217 阅读 · 0 评论 -
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 · 216 阅读 · 0 评论 -
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 · 214 阅读 · 0 评论 -
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 · 242 阅读 · 0 评论 -
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 · 267 阅读 · 0 评论 -
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 · 335 阅读 · 0 评论 -
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 · 244 阅读 · 0 评论 -
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 · 274 阅读 · 0 评论 -
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 · 305 阅读 · 2 评论 -
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 · 310 阅读 · 0 评论 -
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 · 214 阅读 · 0 评论 -
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 · 255 阅读 · 0 评论 -
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 · 198 阅读 · 0 评论 -
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 · 254 阅读 · 0 评论 -
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 · 287 阅读 · 0 评论 -
总结一下刷过的题
今年刷题还是挺爽的 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 · 4805 阅读 · 0 评论