自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 LFU cache Java

public class LFUCache {    HashMap hashtable = new HashMap();    int column;    PriorityQueue priorityQueue;        public LFUCache(int capacity) {        column = capacity;        KeyVa

2016-07-24 11:53:36 642

原创 leetcode: 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.

2015-10-12 03:11:09 389

原创 开始刷leetcode day79:Rectangle Area

Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Assume that the tota

2015-07-28 13:00:33 364

原创 测试server是否block port或者网站

网站:paping apitest.authorize.net -p 443or ping api.test.authorize.netSMTP port 25 blocked or nottelnet my-domain-name.com 25

2015-07-28 03:40:19 712

原创 开始刷leetcode day78:Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next()

2015-07-27 12:21:44 319

转载 开始刷leetcode day78:Lowest Common Ancestor of a Binary Tree

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two node

2015-07-27 11:37:26 367

翻译 在windows server 2008 R2上运行disk cleanup

通常情况下可以在开始-〉Accessories->system tools 里直接找到Disk cleanup但是在windows server 2008 R2里, 找不到。为了可以使用cleanmgr, 需要复制两个文件:cleanmgr.exe, cleanmgr.exe.mui不同的服务器,会在不同的文件夹下找到:Operating S

2015-07-24 02:17:25 4131

转载 读书笔记 day1:The design of approximation algorithms

Chapter 1As P not equal to NP, we cannot simultaneously have algorithms that 1. find optimal solutions; 2. in polynomial time; 3. for any instance.At least one of these requirements need to be

2015-07-23 05:53:58 948

原创 Bug record1: The underlying connection was closed: The connection was closed unexpectedly.Then

Description:Setting up a c# console form for testing another web service called api.svc.After running the web service and make sure it is running correctly, we create the service reference inside

2015-07-23 00:33:28 1740

原创 开始刷leetcode day72: Binary Tree Preorder Traversal

Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive soluti

2015-07-20 10:40:49 279

原创 开始刷leetcode day72:Binary Tree Postorder Traversal

Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solut

2015-07-20 10:33:46 272

转载 开始刷leedtcode day72:Product of Array Except Self

Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O

2015-07-20 09:57:42 480

转载 开始刷leetcode day72: Kth Smallest Element in a BST

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Follow up:What if the

2015-07-20 09:14:53 420

原创 开始刷leetcode day71:Delete Node in a Linked List

Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value

2015-07-19 10:48:42 527

原创 开始刷leetcode day71:Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].Credits:Special thanks to @jianchao.li.fighter 

2015-07-19 10:43:03 258

原创 开始刷leetcode day71: Power of Two

Given an integer, write a function to determine if it is a power of two.Credits:Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.Java:public c

2015-07-19 10:09:56 345

原创 funny makeup story

Yun's Post Apocalyptic Blog Entry 1: Day 1 Hour 1: It's lonely in here. I didn't think the apocalypse would come in the form of coffee zombies. I have my trusty PS Vita and the monitor arm

2015-07-18 02:31:45 602

转载 开始刷leetcode day63: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

2015-07-13 06:42:12 318

转载 开始刷leetcode day63:Contains Duplicate III

Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j] is at most t and the difference between i an

2015-07-13 06:04:55 291

原创 开始刷leetcode day63:Contains Duplicate II

Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between iand j is at most

2015-07-13 05:28:51 233

原创 开始刷leetcode day63: Contains Duplicate

Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element

2015-07-13 05:23:00 265

原创 开始刷leetcode day63:Invert Binary Tree

Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by this original tweet by Max Howell

2015-07-13 05:16:07 238

原创 开始刷leetcode day63:Implement Queue using Stacks

Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empty(

2015-07-13 05:08:02 258

原创 开始刷leetcode day62:Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betw

2015-07-12 05:48:47 267

原创 开始刷leetcode day62: Subsets II

Given a collection of integers that might contain duplicates, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain du

2015-07-12 05:01:27 197

原创 Subsets

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

2015-07-12 04:19:18 256

原创 开始刷leetcode day60: 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

2015-07-08 13:47:17 231

原创 开始刷leetcode day59: Unique Paths

A 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 any point in time. The robot is trying to reach the

2015-07-06 11:20:17 264

原创 开始刷leetcode day49: Populating Next Right Pointers in Each Node

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

2015-06-25 11:26:00 310

转载 开始刷leetcode day47: Word Break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"

2015-06-22 13:37:05 296

转载 开始刷leetcode day47:Gray Code

The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of

2015-06-22 11:38:21 257

转载 开始刷题leetcode day47: Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.java: publ

2015-06-22 11:01:12 388

原创 开始刷leetcode day42:Search in Rotated Sorted Array

Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array retur

2015-06-16 11:16:55 217

原创 开始刷leetcode day41:Implement strStr()

Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02):The signature of the function had been updated

2015-06-15 09:47:10 233

原创 开始刷leetcode day40:Set Matrix Zeroes

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution using O(m

2015-06-14 14:44:22 268

原创 开始刷leetcode day40: Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each

2015-06-14 10:18:10 271

转载 开始刷题 leetcode day39: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

2015-06-12 13:01:02 258

原创 开始刷leetcode day38: Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo

2015-06-11 13:19:02 313

原创 开始刷题leetcode day37:Validate Binary Search Tree

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 keys less than the node's key.Th

2015-06-10 14:01:53 293

原创 开始刷leetcode day32: Rotate List

Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.Java:/** * Definition for

2015-06-05 12:27:10 305

空空如也

空空如也

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

TA关注的人

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