自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 在Emacs 24.4中使用在线字典

使用Emacs时经常需要查英语字典怎么办?切到浏览器查?太慢。我想到一个高效的解决方案,利用新发布的Emacs 24.4中的Web浏览器eww,在Emacs中集成一个在线字典,查询光标处的字,一键搞定。效果如下。如何实现请看我的英文博客。 转载于:https://www.cnblogs.com/guyufei/p/4047989.html...

2014-10-24 12:32:00 91

转载 Emacs下的中文输入

Emacs如此优秀的编辑器,如果输入中文不顺畅,不免遗憾。可惜现实是折腾很久也未必用得称心如意,作为一个重度(也许是中毒) Emacs使用者,根据个人经验写下此文,希望对同道中人有所帮助。 在Windows下,我们可以使用Windows下的任何输入法; 但在Linux下却不行,如需使用ibus或者scim输入中文,要额外配置。最简单的方法一,配置LC_CTYPE(语言符号及其分类)为“...

2014-01-29 16:02:00 163

转载 Binary Tree Zigzag Level Order Traversal [LeetCode]

Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example:Given binary...

2013-12-05 12:51:00 100

转载 Convert Sorted List to Binary Search Tree [LeetCode]

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. Solution: 1 TreeNode *sortedListToBST(ListNode *head) { 2 if(head ...

2013-11-29 07:41:00 72

转载 Balanced Binary Tree [LeetCode]

Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees ofeverynode never di...

2013-11-29 07:22:00 76

转载 Minimum Depth of Binary Tree [LeetCode]

Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Summary: BFS or DFS with recursio...

2013-11-29 06:34:00 77

转载 Sort Colors [LeetCode]

Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the intege...

2013-11-29 05:16:00 73

转载 Remove Duplicates from Sorted Array II [LeetCode]

Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice? For example,Given sorted array A =[1,1,1,2,2,3], Your function should return length =5, and A is now[1,1,2,2,3...

2013-11-27 15:50:00 66

转载 Flatten Binary Tree to Linked List [LeetCode]

Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: ...

2013-11-27 15:15:00 68

转载 Best Time to Buy and Sell Stock III [LeetCode]

Say you have an array for which theithelement is the price of a given stock on dayi. Design an algorithm to find the maximum profit. You may complete at mosttwotransactions. Note:You may n...

2013-11-27 14:28:00 74

转载 Copy List with Random Pointer [LeetCode]

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. Solution: Uses map to recorde...

2013-11-27 12:45:00 86

转载 Validate Binary Search Tree [LeetCode]

Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keysless thanthe node's ...

2013-11-26 14:28:00 65

转载 Rotate Image [LeetCode]

You are given annxn2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place? Solution: 1 void rotate(vector<vector<in...

2013-11-26 13:25:00 78

转载 Add two numbers [LeetCode]

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a...

2013-11-25 15:51:00 81

转载 Implement strStr() [LeetCode]

Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack. Summary: be careful about the corner case, haystack = "", needle ...

2013-11-23 15:34:00 92

转载 Recover Binary Search Tree [LeetCode]

Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note:A solution using O(n) space is pretty straight forward. Could you devise...

2013-11-21 15:33:00 86

转载 Minimum Path Sum [LeetCode]

Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path. Note:You can only move either down or right...

2013-11-21 15:08:00 75

转载 Construct Binary Tree from Preorder and Inorder Traversal [LeetCode]

Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. Solution: Just do it recursively. 1 TreeNode *bu...

2013-11-21 12:09:00 78

转载 LRU Cache [LeetCode]

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset. get(key)- Get the value (will always be positive) of the key ...

2013-11-18 06:21:00 57

转载 Search Insert Position [LeetCode]

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the arr...

2013-11-15 14:17:00 73

转载 Gas Station [LeetCode]

There areNgas stations along a circular route, where the amount of gas at stationiisgas[i]. You have a car with an unlimited gas tank and it costscost[i]of gas to travel from stationito...

2013-11-15 13:32:00 67

转载 Permutation Sequence [LeetCode]

The set[1,2,3,…,n]contains a total ofn! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence (ie, forn= 3): "123" "132" "213" "2...

2013-11-14 16:27:00 69

转载 Binary Tree Level Order Traversal II [LeetCode]

Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For example:Given binary tree{3,9,20,#,#,15,7},...

2013-11-12 12:46:00 49

转载 Remove Duplicates from Sorted List II [LeetCode]

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list. For example,Given1->2->3->3->4->4->5, return1-...

2013-11-11 10:26:00 46

转载 Valid Palindrome [LeetCode]

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Panama"is a palindrome."race a car"isnota p...

2013-11-10 14:02:00 54

转载 Merge Sorted Array [LeetCode]

Given two sorted integer arrays A and B, merge B into A as one sorted array. Note:You may assume that A has enough space to hold additional elements from B. The number of elements initialized in...

2013-11-10 05:53:00 57

转载 Binary Tree Postorder Traversal

Summary: Basic staff, need to check if goes up along the tree, that's the difference to pre-order traverse. 1 vector<int> postorderTraversal(TreeNode *root) { 2 vector<...

2013-11-09 15:50:00 56

转载 Subsets [LeetCode]

Given a set of distinct integers,S, return all possible subsets. Note: Elements in a subset must be in non-descending order. The solution set must not contain duplicate subsets. For e...

2013-11-09 15:18:00 58

转载 Search for a Range [LeetCode]

Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order ofO(logn). If the target is not found...

2013-11-09 14:50:00 95

转载 Reorder List [LeetCode]

Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For example,Given{1,2,3,4}, reorder it to{1,...

2013-11-09 13:54:00 46

转载 Unique Binary Search Trees [LeetCode]

Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n? For example,Givenn= 3, there are a total of 5 unique BST's. 1 3 3 2 1 ...

2013-11-08 14:46:00 63

转载 Longest Consecutive Sequence [LeetCode]

Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given[100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is[1, 2, 3,...

2013-11-08 12:29:00 64

转载 Remove Nth Node From End of List [LeetCode]

Given a linked list, remove thenthnode 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 ...

2013-11-07 14:38:00 54

转载 ZigZag Conversion [LeetCode]

The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A ...

2013-11-07 13:45:00 71

转载 Sudoku Solver [LeetCode]

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. A sudoku puzz...

2013-11-07 12:52:00 95

转载 Populating Next Right Pointers in Each Node [LeetCode]

Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its ...

2013-11-07 09:24:00 60

转载 Binary Tree Level Order Traversal [LeetCode]

Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree{3,9,20,#,#,15,7}, 3 / \ 9 20 ...

2013-11-06 15:53:00 47

转载 Clone Graph [LeetCode]

Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors. OJ's undirected graph serialization: Nodes are labeled uniquely. We use#as a separator for e...

2013-11-06 15:38:00 61

转载 Merge k Sorted Lists [LeetCode]

Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity. Summary: Finds the smallest node every round, then links it to the one sorted list. 1 ...

2013-11-06 13:28:00 60

转载 Combinations [LeetCode]

Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n. For example,Ifn= 4 andk= 2, a solution is: [ [2,4], [3,4], [2,3], [1,2], [...

2013-11-05 15:14:00 71

空空如也

空空如也

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

TA关注的人

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