自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 收藏
  • 关注

原创 LeetCode题解–226. Invert Binary Tree

链接LeetCode题目:https://leetcode.com/problems/invert-binary-tree/ 难度:Easy题目 Invert a binary tree.分析这题比较简单,利用分治的想法就能翻转二叉树。代码class Solution {public: TreeNode* invertTree(TreeNode* root) { i

2017-06-28 19:43:13 228

原创 LeetCode题解–215. Kth Largest Element in an Array

链接LeetCode题目:https://leetcode.com/problems/kth-largest-element-in-an-array/难度:Medium题目 Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order,

2017-06-21 14:54:43 260

原创 LeetCode题解–260. Single Number III

链接LeetCode题目:https://leetcode.com/problems/single-number-iii/难度:Medium题目 Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice

2017-06-15 14:45:15 267

原创 算法概论习题证明

题目8.8. In the EXACT 4SAT problem, the input is a set of clauses, each of which is a disjunction of exactly four literals, and such that each variable occurs at most once in each clause. The goal is to

2017-06-08 14:42:59 346

原创 LeetCode题解–207. Course Schedule

链接LeetCode题目:https://leetcode.com/problems/course-schedule/难度:Medium题目 There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example t

2017-06-07 20:32:17 290

原创 LeetCode题解–134. Gas Station

链接LeetCode题目:https://leetcode.com/problems/gas-station/难度:Medium题目 There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimite

2017-06-01 20:40:24 381

原创 LeetCode题解–143. Reorder List

链接LeetCode题目:https://leetcode.com/problems/minimum-window-substring/难度:Hard题目 Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place wit

2017-05-24 13:27:45 262

原创 LeetCode题解–200. Number of Islands

链接LeetCode题目:https://leetcode.com/problems/number-of-islands/难度:Medium题目 Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is form

2017-05-18 14:42:08 375

原创 LeetCode题解–131. Palindrome Partitioning

链接LeetCode题目:https://leetcode.com/problems/palindrome-partitioning/难度:Medium题目 Given a string s, partition s such that every substring of the partition is a palindrome.题目大意是给定一个字符串,返回所有子串是回文串的划分情况。比

2017-05-11 13:37:16 217

原创 LeetCode题解–135. Candy

链接LeetCode题目:https://leetcode.com/problems/candy/难度:Hard题目 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

2017-05-04 16:23:15 405

原创 LeetCode题解–130. Surrounded Regions

链接LeetCode题目:https://leetcode.com/problems/surrounded-regions/难度:Medium题目 Given a 2D board containing ‘X’ and ‘O’ (the letter O), capture all regions surrounded by ‘X’. A region is captured by fli

2017-04-27 15:19:56 300

原创 LeetCode题解–137. Word Break

链接LeetCode题目:https://leetcode.com/problems/word-break/难度:Medium题目 Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a spa

2017-04-19 13:55:18 280

原创 LeetCode题解–137. Single Number II

链接LeetCode题目:https://leetcode.com/problems/single-number-ii/难度:Medium题目 Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one.

2017-04-13 15:32:13 336

原创 LeetCode题解–72. Edit Distance

链接LeetCode题目:https://leetcode.com/problems/edit-distance/难度:Hard题目 Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as

2017-04-06 14:40:15 287

原创 LeetCode题解–55. Jump Game

链接LeetCode题目:https://leetcode.com/problems/jump-game/难度:Medium题目 Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).

2017-03-30 14:58:01 221

原创 LeetCode题解–76. Minimum Window Substring

链接LeetCode题目:https://leetcode.com/problems/minimum-window-substring/难度:Hard题目 Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(

2017-03-23 21:07:13 266

原创 LeetCode题解–120. Triangle

链接LeetCode题目:https://leetcode.com/problems/triangle/难度:Medium题目 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 exa

2017-03-14 15:24:14 216

原创 LeetCode题解–133. Clone Graph

链接LeetCode题目:https://leetcode.com/problems/clone-graph/难度:Medium题目 Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.该无向图结点包含的信息有整数标签和一个保存所有邻接结点的vector。考

2017-03-09 18:56:40 244

原创 LeetCode题解–46. Permutations

链接LeetCode题目:https://leetcode.com/problems/permutations难度:Medium题目 Given a collection of distinct numbers, return all possible permutations.简单来说,此题的目的是计算n个相异数的所有可能的排列情况。分析这题不算很难,为了得到n个数字的排列,可以先把第1个数

2017-03-03 01:06:27 259

原创 LeetCode题解–4. Median of Two Sorted Arrays

LeetCode题解–4. Median of Two Sorted Arrays

2017-02-24 01:06:10 354

空空如也

空空如也

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

TA关注的人

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