自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

hzj的博客

学习+找工作笔记

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

原创 46.leetcode题目:94. 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 / 3 return [1,3,2]. Note: Recursiv

2016-04-19 18:15:06 239

原创 45.leetcode题目:144. 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 / 3 return [1,2,3]. Note: Recursi

2016-04-17 18:42:54 216

原创 44.leetcode题目:268. Missing Number(位操作没想到)

题目: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. Note: Your algori

2016-04-17 17:12:00 325

原创 43.leetcode题目:319. Bulb Switcher

题目; There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or tur

2016-04-17 16:48:13 254

原创 42.leetcode题目:169. 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

2016-04-15 13:38:36 303

原创 41.leetcode题目217. 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 ele

2016-04-14 21:13:37 232

原创 40.leetcode题目:

这两天在刷leetcode上的动态规划题目,昨天大概刷了三题,但是没有记录博客,因为下周要做报告,所以最近比较忙,故过段时间再添上。我还是希望自己能够坚持下去,仿佛这就意味着我人生的一大步——坚持!! 今天的题目有: 96:unique binary search tree 309. Best Time to Buy and Sell Stock with Cooldown 这

2016-04-06 13:19:42 256

转载 5.动态规划

一、基本概念     动态规划的过程是:每次决策依赖于当前状态,又随机引起状态的转移。     动态规划算法通常都是基于一个递推公式及一个或多个初始状态。当前子问题的解由上一次子问题的解推出。使用动态规划解题只需要多项式时间复杂度,因此比回溯法、暴力法等要快。 二、示例       注:原文转载自: 动态规划:从新手到专家 March 26, 2013 作者:H

2016-04-03 16:10:09 842

原创 39.leetcode题目121、 122、 123

121题:动态规划 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

2016-04-02 21:14:05 329

原创 38.leetcode题目231:231. Power of Two

题目: Given an integer, write a function to determine if it is a power of two. 分析: 判断是否是2的整数次幂。 class Solution { public: bool isPowerOfTwo(int n) { if(n<=0) return false;

2016-04-02 16:23:56 223

原创 37.leetcode题目191: 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

2016-04-02 15:51:30 259

原创 36.leetcode题目338: Counting Bits(再做一遍)

题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array. Example: Fo

2016-04-02 15:24:18 237

原创 35.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. 分析:

2016-04-02 14:02:21 223

原创 34.leetcode题目260: Single Number III

题目: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. For example:

2016-04-02 12:26:38 207

原创 33.leetcode题目237: 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 w

2016-04-02 11:05:26 193

原创 32.leetcode题目283: Move Zeroes

题目: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after ca

2016-04-01 14:41:44 195

原创 31.leetcode题目226: Invert Binary Tree

题目: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 分析:递归调用 class Solution { public: TreeNode* invertTree(Tre

2016-04-01 13:52:45 187

空空如也

空空如也

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

TA关注的人

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