自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

cheney的专栏

一个有修养的程序员

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

原创 Palindrome Number

问题描述:Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking o

2014-12-23 15:26:53 248

原创 Intersection of Two Linked Lists

问题描述:For example, the following two linked lists:A: a1 → a2 ↘ c1 → c2 → c3 ↗ B: b1 → b2 → b3begin to in

2014-12-22 15:09:51 262

原创 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 majori

2014-12-22 14:12:20 378

原创 Balanced Binary Tree

问题描述: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 of every node

2014-12-19 14:54:05 304

原创 ZigZag Conversion

class Solution {public: string convert(string s, int nRows) { if(s.empty() || nRows <= 1 || s.length() < nRows) return s; string sub[nRows]; int pos[nRows];

2014-12-11 21:28:22 277

原创 Remove Duplicates from Sorted List

问题描述:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.解决思路:定义两个指针b

2014-12-11 17:03:23 288

原创 Binary Tree Level Order Traversal II

问题描述:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,

2014-12-10 18:42:03 731

原创 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,#,#,15,7}, 3 / \

2014-12-10 16:29:01 316

原创 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: Recur

2014-12-10 10:53:06 296

原创 Binary Tree Inorder Traversal

问题描述:Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recurs

2014-12-09 17:19:40 349

原创 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?解决思路:采用快慢指针的方法,快指针一次走两步,慢指针一次走一步,如果链表中有环的话,经过走一定的步数之后快慢指针一定会相遇的,当然如果没有环就需

2014-12-08 16:18:39 275

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

2014-12-08 15:57:36 243

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

2014-12-08 14:50:12 288

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

2014-12-04 16:47:58 296

原创 Maximum Depth of Binary Tree

问题描述:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.解决思路:DFS分别求出左子树和右子树的最大深度然

2014-12-04 16:20:03 252

原创 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 withou

2014-12-04 15:49:41 278

空空如也

空空如也

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

TA关注的人

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