自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

R_xiaozhu_Q的专栏

love what i'm loving~

  • 博客(62)
  • 资源 (4)
  • 收藏
  • 关注

原创 【LeetCode】 Valid Sudoku

Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially fille

2013-10-31 18:58:26 1418

原创 【LeetCode】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 / \

2013-10-31 14:36:39 1938

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

2013-10-30 15:23:10 7345 3

原创 【LeetCode】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?java code : 很简单的判断单链表是否有环。/** * Definition for singly-linked list. * class

2013-10-29 22:21:57 2516

原创 【LeetCode】Trapping Rain Water 2013年美团网校园招聘研发工程师笔试题

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],

2013-10-29 22:07:30 1191

原创 【LeetCode】Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.java code : 预处理出最短串与任意一字符串的公共前缀,用StringBuilder保存,再去遍历剩余字符串,从尾处开始推。复杂度O(m * n)  m : length of the arrays, n :le

2013-10-29 17:01:43 959

原创 【LeetCode】 Subsets Subsets II

Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For example,

2013-10-29 15:43:32 1287

原创 【LeetCode】Search 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).You are given a target value to search. If found in the array return it

2013-10-27 13:06:58 1056

原创 【LeetCode】3Sum Closest

Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exact

2013-10-27 10:48:49 1026

原创 【LeetCode OJ】Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va

2013-10-26 20:35:41 886

原创 Java NIO 非阻塞式 C/S结构简易 多人聊天室

使用JAVA 的 NIO 实现了服务器端 / 客户端 结构的简易多人聊天室:说明都在代码注释里了,希望可以不断完善服务器端:import java.io.IOException;import java.net.InetSocketAddress;import java.nio.ByteBuffer;import java.nio.channels.Channel;impor

2013-10-25 22:06:50 2387

原创 【LeetCode OJ】 Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.cpp code : 暴力求解,递归到每一个叶子节点,记录深度,

2013-10-25 12:58:44 803

原创 【LeetCode OJ】Combinations

Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]

2013-10-25 10:28:18 800

原创 Java 简易C/S结构多线程聊天室 (阻塞式)

主要实现的功能:服务器端建立ServerSocket阻塞监听来自客户端的Socket连接,并为之开辟一个新的线程读取来自该连接的数据,广播每一个客户端数据,这里简单地使用一个链表保存所有来自客户端的所有Socket连接客户端连接上服务器端后主要有两个线程在工作:主线程:不断获取键盘的输入并写入该Socket中传输给服务器副线程:不断从服务器Socket流中读取传来的数据,打印到

2013-10-24 22:36:13 2761 2

原创 【LeetCode OJ】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

2013-10-24 14:14:45 2281

原创 Java 多线程下载

开发环境:win 7 (64 bit) + eclipse 还未实现断点下载,如需实现断点下载,则需要额外增加一个配置文件:import java.io.InputStream;import java.io.RandomAccessFile;import java.net.HttpURLConnection;import java.net.URL;public class

2013-10-23 19:48:04 847

原创 【LeetCode OJ】Set Matrix Zeroes

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution using O(m

2013-10-22 18:52:42 1527

原创 【LeetCode OJ】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

2013-10-22 13:09:41 1261

原创 【LeetCode OJ】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 without using

2013-10-21 13:17:40 2660

原创 【LeetCodeOJ】Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum

2013-10-20 23:12:42 958

原创 【LeetCode】Sort Colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers

2013-10-20 20:20:53 1671

原创 使用XAMPP可视化管理Mysql,使用JDBC访问数据库执行插入、查询、删除等操作

准备工作:安装XAMPP,登陆apache,mysql,并通过phpadmin来创建数据库,新建一个表,插入一些数据:http://localhost/phpmyadmin,最好设置密码,不然后面连接数据库的时候可能会无法访问设置密码方式:修改密码--->一定要使用生成的密码来登陆,包括后面的数据库url也是。我简历的数据如下:这时候就可以在eclipse中编程开发

2013-10-20 14:08:17 5726 1

原创 【LeetCode】Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the

2013-10-19 14:02:01 1307

原创 【LeetCode】Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()

2013-10-19 10:24:21 1388

原创 【LeetCode】Spiral Matrix II

Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [

2013-10-19 09:38:58 1458

原创 【LeetCode】Permutations

Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].code: STL met

2013-10-15 13:18:30 1073

原创 【LeetCode】Plus One

Given a number represented as an array of digits, plus one to the number.hint : 类似于字符串模拟加减法的思路:class Solution {public: vector plusOne(vector &digits) { // Note: The Solution object

2013-10-14 14:58:43 667

原创 【LeetCode】Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at

2013-10-13 20:41:06 934

原创 【LeetCode】Unique Paths

A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the

2013-10-13 17:30:36 1668

原创 【LeetCode】Search a 2D Matrix (杨氏矩阵查找)

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each

2013-10-13 09:35:14 1102

转载 【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

2013-10-12 10:22:26 892

原创 【LeetCode】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?注意:只开辟O(K)的内

2013-10-10 22:20:06 855

原创 【LeetCode】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 never diffe

2013-10-10 14:28:30 1741

原创 【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),

2013-10-08 21:16:32 721

原创 【LeetCode】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,#,#,15,7},

2013-10-08 19:24:28 1104

原创 【LeetCode】Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y

2013-10-07 20:27:23 1020

原创 【LeetCode】Pascal's Triangle (杨辉三角)

Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]code :class Solution {pu

2013-10-07 13:49:49 3177

原创 【LeetCode】Merge Two Sorted Lists

description:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.code: (注意不能申请新的结点空间,必须原地操作)/** * D

2013-10-07 13:20:44 985

原创 【挑战程序设计竞赛】后缀数组 实现字符串匹配

字符串后缀Suffix 指的是从字符串的某个位置开始到其末尾的字符串字串后缀数组 Suffix Array 指的是将某个字符串的所有后缀按字典序排序之后得到的数组,不过数组中不直接保存所有的后缀子串,只要记录相应的位置就好了。下面的代码使用倍增法来构造后缀数组,该算法的复杂度是 O(n log n)常数因子比较大。基于后缀数组的字符串匹配,我们可以通过二分搜索来完成,算法复杂度是

2013-10-07 11:14:34 2475 1

原创 【九度0J】 题目1535:重叠的最长子串 (扩展KMP算法)(滚动哈希算法--Rabin-Karp算法)

题目描述:给定两个字符串,求它们前后重叠的最长子串的长度,比如"abcde"和“cdefg”是"cde",长度为3。输入:输入可能包含多个测试案例。对于每个测试案例只有一行, 包含两个字符串。字符串长度不超过1000000,仅包含字符'a'-'z'。输出:对应每个测试案例,输出它们前后重叠的最长子串的长度。样例

2013-10-06 15:52:55 3366

第五届华为创新杯编程大赛--块分配问题

2013年华为第五届创新杯编程大赛决赛试题

2013-05-31

c++primer plus第七章到第十三章习题源码

自己做的答案,全部亲自通过编译。从第七章开始,前面几章在网上能下到全部版本的答案,而从第七章开始却没有

2013-03-12

飞凌ok6410开发板使用导读

使用开发板之前,读次文档能够帮助你勾画一个宏观的轮廓,找得到方向,还有一些注意事项。

2012-10-24

飞凌6410裸机调试教程

基于飞凌公司出产的OK6410,ARM11板子的裸机调试教程,比较初级。 是帮助入门开发板的人。

2012-10-24

空空如也

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

TA关注的人

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