自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Clairezz_的博客

Never give up!

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

原创 [leetcode][string] String to Integer (atoi)

题目:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible

2015-05-25 13:37:32 285

原创 [leetcode][list] Reverse Linked List

题目:Reverse a singly linked list.click to show more hints.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?非递归实现/** * Definition for s

2015-05-23 20:15:27 350

原创 [leetcode][hash] Isomorphic Strings

题目:Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced

2015-05-23 19:58:59 347

原创 [leetcode][math][hash] Count Primes

题目:Description:Count the number of prime numbers less than a non-negative number, n.Credits:Special thanks to @mithmatt for adding this problem and creating all test cases.Hint

2015-05-23 19:24:49 376

原创 [leetcode][list] Remove Linked List Elements

题目:Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5/** * Definiti

2015-05-23 17:15:44 292

原创 [leetcode][hash][math] Happy Number

题目:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of th

2015-05-23 16:28:15 252

原创 [leetcode][bit] Bitwise AND of Numbers Range

题目:Given a range [m, n] where 0 For example, given the range [5, 7], you should return 4.方法一:class Solution {public: int rangeBitwiseAnd(int m, int n) { //设从最高位开始第一个m和n不同的位为i,则从i开始其

2015-05-23 16:03:32 330

原创 [leetcode][tree] Binary Tree Right Side View

题目:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:Given the following binary tree

2015-05-23 15:39:42 363

原创 [leetcode][DP] House Robber

题目:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjac

2015-05-23 15:03:16 233

原创 [leetcode][bit] Number of 1 Bits

题目:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representati

2015-05-23 14:44:52 314

原创 [leetcode][bit] Reverse Bits

题目“:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as

2015-05-23 14:29:17 354

原创 [leetcode][array] Rotate Array

题目;Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note:Try to come up as many soluti

2015-05-23 13:41:10 233

原创 [leetcode][tree][stack] 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.Not

2015-05-23 13:17:26 230

原创 [leetcode][math] Excel Sheet Column Number

题目:Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3

2015-05-23 12:39:26 406

原创 [leetcode][math] Excel Sheet Column Title

题目:Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB

2015-05-23 12:30:55 296

原创 [leetcode][array] Majority Element

题目:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority

2015-05-23 12:06:39 286

原创 [leetcode][search] Find Peak Element

题目:A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple

2015-05-23 08:56:05 341

原创 [leetcode][list] Intersection of Two Linked Lists

题目:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2015-05-22 22:58:02 267

原创 [leetcode][stack] Min Stack

题目:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top(

2015-05-22 22:33:49 269

原创 [leetcode][search] Find Minimum in Rotated Sorted Array II

题目:Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose a sorted array is rotated at som

2015-05-22 22:21:46 281

原创 [leetcode][search] Find Minimum 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).Find the minimum element.You may assume no duplicate e

2015-05-22 22:17:34 282

原创 [leetcode][list][sort] Sort List

题目;Sort a linked list in O(n log n) time using constant space complexity./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(i

2015-05-22 21:35:47 268

原创 [leetcode][tree] 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: Recurs

2015-05-22 19:59:20 203

转载 VS2010灵活运用快捷操作功能(总结)

原文地址1.快速using(这个的快捷键是ctrl+.)2.快速回到之前编辑的代码页面现在的项目动不动就几十个代码页面,经常需要在几个页面之间跳来跳去,这时就需要这两个快捷键:CTRL + - 向后定位,回到上一个编辑的光标点CTRL + TAB 回到上一个文档窗口,CTRL按住不放再按TAB可以选择要切换的文档窗口。这个功能和WINDOWS的ALT+TAB类似

2015-05-22 19:42:00 704

原创 [leetcode][tree] 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].递归实现:/** * D

2015-05-22 18:19:29 207

原创 [leetcode][list][sort] Insertion Sort List

题目;Sort a linked list using insertion sort./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} *

2015-05-22 18:13:08 201

原创 [leetcode][list] Reorder List

题目: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 without altering the nodes' values.For example,Given {1,2,3,4}, reord

2015-05-22 18:00:22 266

原创 [leetcode][list][two pointers] Linked List Cycle II

题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked

2015-05-22 14:33:59 212

原创 [leetcode][list][two pointers] Linked List Cycle

题目:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. * struct ListNode { * int v

2015-05-22 14:16:50 312

原创 [leetcode][list] Copy List with Random Pointer

题目: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./** * Definition for

2015-05-22 13:44:46 224

原创 [leetcode][hash] Single Number II

题目:Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it wi

2015-05-22 13:16:07 327

原创 [leetcode][bit] Single Number

题目:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without

2015-05-22 12:54:35 245

原创 [leetcode][tree][dfs] Sum Root to Leaf Numbers

题目:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find

2015-05-22 12:45:34 327

原创 [leetcode][array] Longest Consecutive Sequence

题目: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

2015-05-22 11:06:48 235

原创 [leetcode][string][two pointers] Valid Palindrome

题目: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" 

2015-05-21 23:09:22 230

原创 [leetcode][DP] Best Time to Buy and Sell Stock III

题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:

2015-05-21 22:22:37 295

原创 [leetcode][贪心] Best Time to Buy and Sell Stock II

题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i

2015-05-21 21:51:08 322

原创 [leetcode][DP] Best Time to Buy and Sell Stock

题目:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of th

2015-05-21 21:45:33 291

原创 [leetcode][DP] Triangle

题目: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 example, given the following triangle[ [2], [3

2015-05-21 20:58:30 237

原创 [leetcode][array] Pascal's Triangle II

题目:Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space?class

2015-05-21 20:32:41 213

空空如也

空空如也

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

TA关注的人

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