自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(59)
  • 资源 (2)
  • 收藏
  • 关注

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

2014-12-31 15:42:31 438

原创 [LeetCode] Factorial Trailing Zeroes

Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.class Solution {public: int trailingZeroes(int n) { int

2014-12-31 15:25:59 471

原创 java.net.BindException: Address already in use: connect

用HttpURLConnection频繁连接Linux服务器时,出现了 java.net.BindException: Address already in use: connect 这个错误,说明端口冲突了。why?我明明每次连接后都会执行Connection.disconnect()这个操作。其实答案跟上篇博客差不多,都是TIME_WAIT在作怪,于是只有执行下Thread.sleep

2014-12-31 13:25:55 699

原创 频繁连接断开mysql出现的问题

今天写的程序需要频繁执行连接断开mysql这一操作,而且时间间隔又很短,于是乎出现了下面这个问题The driver was unable to create a connection due to an inability to establish the client portion of a socket.This is usually caused by a limit on the

2014-12-31 13:05:14 5333

原创 [LeetCode] Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3Return 6.

2014-12-30 15:04:40 328

原创 [LeetCode] 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 extr

2014-12-29 17:09:59 253

原创 [LeetCode] Recover Binary Search Tree

Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty straight forward. Could you devis

2014-12-29 16:27:48 388

原创 [LeetCode] String to Integer (atoi)

Implement atoi to convert a string to an integer.class Solution {public: int atoi(const char *str) { int i = 0,flag = 1; long long ans = 0; while(str[i] == ' ') i ++;

2014-12-28 21:58:41 326

原创 [LeetCode] 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.class Solution {p

2014-12-28 21:03:47 316

原创 [LeetCode] Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.A sudoku

2014-12-28 19:08:01 277

原创 [LeetCode] Surrounded Regions

Given a 2D board containing 'X' and '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 X XX O O X

2014-12-26 17:01:30 303

原创 [LeetCode] 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 element

2014-12-26 14:13:43 288

原创 [LeetCode] Clone Graph

Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for each

2014-12-25 17:00:00 210

原创 [LeetCode] Construct Binary Tree from Inorder and Postorder Traversal

Given inorder and postorder traversal of a tree, construct the binary tree./** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; *

2014-12-25 15:57:02 259

原创 [LeetCode] Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversal of a tree, construct the binary tree./** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; *

2014-12-25 14:56:52 275

原创 [LeetCode] Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; *

2014-12-25 13:42:40 231

原创 [LeetCode] 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./** * Definition for singly-linked list. * struct ListNode { * int val; * Lis

2014-12-25 13:36:34 270

原创 [LeetCode] 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

2014-12-24 21:34:10 273

原创 [LeetCode] 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. If t

2014-12-24 16:56:51 261

原创 [LeetCode] 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

2014-12-24 16:09:22 330

原创 [LeetCode] 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

2014-12-23 17:17:46 240

原创 [LeetCode] 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 ↘

2014-12-19 17:17:12 333

原创 [LeetCode] Largest Rectangle in Histogram

Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width o

2014-12-19 16:51:05 302

原创 [LeetCode] Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+

2014-12-18 16:57:06 321

原创 [LeetCode] Edit Distance

Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:

2014-12-18 16:31:04 295

原创 [LeetCode] 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"

2014-12-18 15:37:40 300

原创 [LeetCode] Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?class Solution {public:

2014-12-18 14:16:51 280

原创 [LeetCode] 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

2014-12-16 17:04:32 1464

原创 [LeetCode] 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

2014-12-16 16:01:21 260

原创 [LeetCode] 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:You ma

2014-12-16 14:56:43 330

原创 [LeetCode] 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 the stock),

2014-12-15 16:17:18 306

原创 [LeetCode] Trapping Rain Water

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]

2014-12-12 17:26:18 244

原创 [LeetCode] Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin

2014-12-12 16:16:27 322

原创 [LeetCode] 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

2014-12-12 14:45:43 234

原创 [LeetCode] Jump Game II

Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal i

2014-12-11 14:51:56 253

原创 [LeetCode] Jump Game

Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine i

2014-12-11 13:49:34 222

原创 [LeetCode] 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

2014-12-10 17:15:53 288

原创 [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 (ie, buy on

2014-12-10 16:18:01 262

原创 [LeetCode] Distinct Subsequences

Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be non

2014-12-10 13:57:54 265

原创 [LeetCode] Multiply Strings

Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.class Solution {public: string m

2014-12-09 16:14:03 295

计算机组成运算器相关课件

第一个组成部分是算逻运算部件ALU, 能完成 3 种算术运算和5 种逻辑运算功能 第二个组成部分是通用寄存器组由16个寄存器构成,并通过A口与B口地址选择被读的寄存器,B口地址还用于 指定写入寄存器通过B口地址、A口地址读出的数据将送到B、 A锁存器,要写入寄存器的数据由一个多路选择器送来。 第三个组成部分是乘商寄存器Q 它能对自己的内容完成左右移位 功能,其输出可以送往ALU,并 可接收ALU的输出结果。 第四个组成部分是 多路选通门

2010-09-28

空空如也

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

TA关注的人

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