自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(195)
  • 资源 (6)
  • 收藏
  • 关注

原创 162. 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 peaks, in

2017-09-13 12:44:36 338

原创 154. 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 an array sorted in ascending order is rotated

2017-09-13 12:22:32 370 1

原创 153. Find Minimum in Rotated Sorted Array

Suppose an array sorted in ascending order 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

2017-09-13 11:24:18 397 1

原创 152. Maximum Product Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the larges

2017-09-13 11:08:19 401 1

原创 binary tree traver

1. preorder travelclass Solution {public: vector preorderTraversal(TreeNode* root) { vector result; stack myStack; TreeNode * temp = root; while(!myStack.empty()

2017-09-12 15:51:55 372 1

原创 139. Word Break

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 space-separated sequence of one or more dictionary words. You may as

2017-09-11 21:16:19 349 1

原创 137. Single Number II

Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one.Note:Your algorithm should have a linear runtime complexity. Coul

2017-09-11 18:53:57 308 1

原创 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 least on

2017-09-11 16:31:01 287 1

原创 134. Gas Station

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 unlimited gas tank and it costs cost[i] of gas to travel from station i to

2017-09-11 15:30:33 285 1

原创 131. Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return[ ["aa","b"], [

2017-09-10 16:29:25 293 1

原创 刷题七

给定一个N位数,例如12345,从里面去掉k个数字,得到一个N-k位的数,例如去掉2,4,得到135,去掉1,5,得到234。设计算法,求出所有得到的N-k位数里面最小的那一个?class Solution{ bool myFunc(vector & array, int m, vector & result){ if(array.size() <= m)

2017-09-05 21:17:25 344

原创 刷题六

求最大连续子序列和#include #include #include "math.h"#include "limits.h"using namespace std;class Solution{ public: int myMax(vector & array){ if(array.size() == 0) return 0

2017-09-05 19:17:52 277

原创 刷题五

字符串A和字符串B。是否B包含了A所有的字符#include #include using namespace std;class Solution{ public: bool myCheck(string & str1, string & str2){ if(str1.length() == 0) return true; if(str

2017-09-05 16:59:02 280

原创 刷题四

两个有序链表的合并class Solution{ public: Node * myMerge(Node * list1, Node * list2){ if(list1 == null) return list2; if(list2 == null) return list1; Node * head = new Node();

2017-09-05 16:45:47 237

原创 刷题三

给出一串数字,判断是否为有效二叉查找树的后序遍历序列(及是否能够通过这串后序遍历序列构造出二叉查找树)#include #include using namespace std;class Solution{ public: bool myCheck(vector & array){ int length = array.size();

2017-09-05 16:13:52 259

原创 刷题二

实现带有重复元素的二分查找,如果查找的元素重复,返回重复元素的起始位置。#include #include using namespace std;class Solution{ public: int binarySearch(vector & array, int target){ if(array.size() == 0)

2017-09-05 15:37:12 257

原创 刷题

对于数组A[0,1,2,3,4,...,k],求得0#include #include #include "math.h"using namespace std;class Solution{ public: bool maxSum(vector & array, int & result){ if(array.size() <= 1)

2017-09-05 15:08:25 387

原创 130. Surrounded Regions

Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X

2017-06-27 15:16:08 248

原创 127. Word Ladder

Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:Only one letter can be changed at a

2017-06-27 11:06:56 344 1

原创 下次涨点记性吧

到今天,一波实习已经结束了,国内公司倒了一片,好在还有微软。虽然转正不易,但能去实习我也知足了。回顾长达两个月的实习厮杀,自己前期准备的太少,导致前面的面试都非常不理想。2月13号开学,那会儿只是单纯的刷刷LeetCode,因为之前完全没刷过,同桌已经刷了半年,拼命赶进度,差不多刷了两周,刷了100多道medium,easy跟hard都没做。这个时候就到了2月底,阿里的实习已经开始发布招聘

2017-04-27 17:17:50 472

原创 生成格雷码

在一组数的编码中,若任意两个相邻的代码只有一位二进制数不同, 则称这种编码为格雷码(Gray Code),请编写一个函数,使用递归的方法生成N位的格雷码。给定一个整数n,请返回n位的格雷码,顺序为从0开始。测试样例:1返回:["0","1"]class GrayCode {public: vector getGray(int n) {

2017-03-23 19:29:26 471 1

原创 LeetCode 129. 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 the tota

2017-02-28 19:39:19 342

原创 LeetCode 117. Populating Next Right Pointers in Each Node II

Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant

2017-02-27 21:13:37 269 1

原创 LeetCode 116. 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.

2017-02-27 20:52:17 382 1

原创 LeetCode 114. Flatten Binary Tree to Linked List

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

2017-02-27 20:14:41 361 1

原创 LeetCode 120. 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,4], [

2017-02-24 20:18:30 257 1

原创 LeetCode 113. Path Sum II

Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \

2017-02-23 22:12:03 292 1

原创 LeetCode 109. Convert Sorted List to Binary Search Tree

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

2017-02-23 21:22:39 421 1

原创 LeetCode 108. Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.answer:class Solution {public: TreeNode* sortedArrayToBST(vector& nums) { return myATB

2017-02-23 20:46:17 372

原创 LeeCode 106. Construct Binary Tree from Inorder and Postorder Traversal

Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.recursive answer:class Solution {public: TreeNode

2017-02-23 15:13:32 352 1

原创 LeetCode 105. Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.recursive answer:递归方法:在preorder找到root节点,接着在inorder里找到ro

2017-02-23 14:33:33 393

原创 LeetCode 103. Binary Tree Zigzag Level Order Traversal

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

2017-02-23 13:44:11 291 1

原创 LeetCode 102. Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 2

2017-02-23 13:12:56 247 1

原创 LeetCode 100. Same Tree

Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.answer:

2017-02-23 11:22:32 265

原创 LeetCode 98. 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

2017-02-23 10:58:24 269

原创 LeetCode 96. Unique Binary Search Trees

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

2017-02-22 21:40:41 293 1

原创 LeetCode 94. Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2].recursive solution:

2017-02-22 20:29:28 244 1

原创 LeetCode 93. Restore IP Addresses

Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]. (Order

2017-02-22 19:45:36 226 1

原创 LeetCode 92. Reverse Linked List II

Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note:Given m, n satisfy the

2017-02-22 18:41:16 364 1

原创 LeetCode 91. Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total nu

2017-02-22 16:56:16 321

vassistx破解

解压以后点击exe安装,最重要的是要先卸载以前的vassistx!!! VS2010 将VA_X.dll拷贝到以下目录覆盖同名文件。 (Win7) C:\Users\用户名\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Whole Tomato Software\Visual Assist X\10.9.2052.0 (XP) C:\Documents and Settings\用户名\Local Settings\Application Data\Microsoft\VisualStudio\10.0\Extensions\Whole Tomato Software\Visual Assist X\10.9.2052.0

2015-11-09

1004. 成绩排名

1004. 成绩排名 PAT C++,可用

2015-01-20

1003. 我要通过!

1003. 我要通过! PAT C++,可用

2015-01-20

1002. 写出这个数

1002. 写出这个数 PAT C++,可用

2015-01-20

1014. 福尔摩斯的约会

1014. 福尔摩斯的约会 pat 可用

2015-01-20

1001. 害死人不偿命的(3n+1)猜想

PAT 1001. 害死人不偿命的(3n+1)猜想 C实现

2015-01-19

空空如也

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

TA关注的人

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