编写历程
文章平均质量分 50
EricGuo55
兜兜转转,团团圆圆
展开
-
(LeetCode 264) Ugly Number II
Q: Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10原创 2016-04-18 21:58:40 · 349 阅读 · 0 评论 -
(LeetCode 322) Coin Change
Q: You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of mon原创 2016-04-18 11:16:46 · 599 阅读 · 0 评论 -
(LeetCode 342) Power of Four
Q: Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example: Given num = 16, return true. Given num = 5, return false.Follow up: Could you solve it without loop原创 2016-04-19 10:56:11 · 556 阅读 · 0 评论 -
(LeetCode 299) Bulls and Cows (HashTable)
Q: You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint原创 2016-04-19 12:23:38 · 462 阅读 · 0 评论 -
(LeetCode 279) Perfect Squares
Q: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n.For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n = 13, re原创 2016-04-19 10:36:01 · 336 阅读 · 0 评论 -
(LeetCode 101) Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3 题意就是问一个二叉树是不是对称的。sol原创 2016-04-18 23:32:31 · 265 阅读 · 0 评论 -
(LeetCode 223) Rectangle Area
Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure. Assume that the total area is原创 2016-04-19 21:58:14 · 595 阅读 · 0 评论 -
(LeetCode 130)Surrounded Regions(并查集)
Q: 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 X X O O X X X O X原创 2016-04-20 22:07:34 · 3806 阅读 · 0 评论 -
(LeetCode 200)Number of Islands(并查集、DFS)
Q: Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may ass原创 2016-04-20 23:23:59 · 3632 阅读 · 0 评论 -
并查集(Union-Find)算法介绍
原博地址:http://blog.csdn.net/dm_vincent/article/details/7655764本文主要介绍解决动态连通性一类问题的一种算法,使用到了一种叫做并查集的数据结构,称为Union-Find。更多的信息可以参考Algorithms 一书的Section 1.5,实际上本文也就是基于它的一篇读后感吧。原文中更多的是给出一些结论,我尝试给出一些转载 2016-04-20 23:27:42 · 429 阅读 · 0 评论 -
(LeetCode 16) 3Sum Closest
Q: 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 exac原创 2016-04-22 00:36:28 · 358 阅读 · 0 评论 -
(LeetCode 130) Surrounded Regions(BFS)
Q: 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 X X O O X X X O X原创 2016-04-20 16:45:54 · 1742 阅读 · 0 评论 -
(LeetCode 15) 3Sum
Q: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: Elements in a triplet (a,b,c) must原创 2016-04-22 00:57:42 · 381 阅读 · 0 评论 -
(LeetCode 18) 4Sum
Q: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: Elements in a原创 2016-04-22 01:04:44 · 396 阅读 · 0 评论 -
JSP页面中文乱码问题处理
JSP页面显示乱码,可以将JSP代码中的charset和pageEncoding设置为utf-8 如下:<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional原创 2016-09-08 14:32:42 · 818 阅读 · 0 评论 -
Eclipse中修改JSP文件名称后无法访问解决方法(404)
eclipse中Rename jsp文件后,相应的jsp文件无法访问,出现404问题解决方案: jsp文件名修改后,tomcat服务器上的文件仍未修改,这时就会访问不到文件,需要把tomcat缓存清除一下。首先remove tomcat下该项目,然后重新部署,再像下面一样clean一下就可以了参考链接:http://tieba.baidu.com/p/2467361177原创 2016-09-08 19:52:24 · 6676 阅读 · 0 评论 -
(LeetCode 79) Word Search
Q: Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or vertically原创 2016-04-18 21:04:41 · 370 阅读 · 0 评论 -
(LeetCode 202) Happy Number
Q: Write an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares原创 2016-04-17 17:11:39 · 296 阅读 · 0 评论 -
小白做图像处理
po主从今天开始做图像匹配方面的研究,每天把自己学到的新东西放上来,当做是记录自己成长的足迹吧,加油原创 2015-07-28 10:06:15 · 544 阅读 · 0 评论 -
You have an error in your SQL syntax;解决方法
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the rig...,出现上面错误信息怎么解决。Matlab从Mysql中取数据出现以上错误信息,不用检查其他的,检查你的SQL语句吧,一般都是SQL语句出错了原创 2015-08-19 09:57:57 · 2696 阅读 · 0 评论 -
Communications link failure Last packet sent to the server was 0 ms ago.问题解决
在使用Matlab连接Mysql数据库的时候常常出现这个问题,最后发现因为使用的是网上的数据库,通过本地的Mysql创建原创 2015-08-19 09:53:53 · 4341 阅读 · 1 评论 -
使用正则表达式解析一般sql语句(C++)
趁这个时候把之前写过的代码都贴上来吧。 正则表达式一用,整个人都感觉神清气爽了,会了正则表达式,表示字符串解析什么的,顿时轻松了不少啊。不过C和C++现存的大部分编译器是不支持正则表达式的,最新出来的C++10标准(貌似是C++10)中新加入了正则表达式,但是支持最新标准的编译器较少,VS最新版本的应该是支持的。不过博主一直对CodeBlocks情有独钟,忠心不二啊。这就得给编译器装boost函数原创 2015-08-17 02:39:56 · 5806 阅读 · 1 评论 -
web挖掘之Apriori算法 JAVA实现
博主初次接触数据挖掘方面的研究,从最经典最基础的Apriori算法编起,不过这是博主前几个月写的了,所以现在也是凭印象写的,有些粗糙,还请谅解。下面讲解部分为转载1 Apriori介绍 Apriori算法使用频繁项集的先验知识,使用一种称作逐层搜索的迭代方法,k项集用于探索(k+1)项集。首先,通过扫描事务(交易)记录,找出所有的频繁1项集,该集合记做L1,然后利用L1找频繁2项集的集合L2,L2原创 2015-08-17 01:52:25 · 2835 阅读 · 0 评论 -
关于C++中枚举和整型之间的转换
楼主今儿学着的,关于枚举和整型之间转换的简单说明;C++中,枚举xiang原创 2014-05-22 21:27:49 · 17861 阅读 · 0 评论 -
poj3278 Catch That Cow (BFS算法和队列)
哈哈,还记得老师说过所有关于奶牛的poj原创 2014-04-09 23:06:04 · 1204 阅读 · 0 评论 -
poj3250 Bad Hair Day(单调栈)
博主表示菜鸟一个,刚刚开通博客,记录下自己学习变成的原创 2014-04-09 21:56:02 · 958 阅读 · 0 评论 -
使用逆波兰式(后缀表达式)实现多功能计算器
由于这是之前的小作业了,之前贴出来没注意,后来发现格式太乱了根本看不了,所以今天再贴出来一下,这次的计算器比我之前写的要复杂很多,主要是通过逆波兰式实现的,没有界面,计算器是我之前的一个软肋啊,编了好多次都没有写出来。 这次这个,我试着调了很多次bug,以及很多种情况,尽量完善了,但是如果还有没考虑周全的,希望大家提出来,亲测代码可用。当然,为了方便起见,我把代码都整合到一个cpp文件的,主要也是原创 2015-08-17 01:06:37 · 6272 阅读 · 1 评论 -
(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 representation 000000000原创 2016-04-16 00:29:33 · 341 阅读 · 0 评论 -
(LeetCode 190) Reverse Bits
Q: Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 0011100101原创 2016-04-16 01:16:42 · 374 阅读 · 0 评论 -
(LeetCode 231)Power of Two
题: Given an integer, write a function to determine if it is a power of two.也就是判断一个数是不是2的幂次方solution: 这道题解法很多,最简单的就是循环。 已知2的幂次方的二进制中有且只有一位为1。 我们向右移动,直到当前位为1。再在当前状态右移一位,如果是零那么就是2的幂次方。class Solution {原创 2016-04-15 23:54:43 · 460 阅读 · 0 评论 -
(LeetCode 303) Range Sum Query - Immutable
Q: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example: Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1 sumRange(2, 5) -> -1 sumRange(原创 2016-04-16 09:49:57 · 354 阅读 · 0 评论 -
(LeetCode 304) Range Sum Query 2D - Immutable
Q: Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2). Range Sum Query 2D The above rectang原创 2016-04-16 12:47:54 · 365 阅读 · 0 评论 -
(LeetCode 307) Range Sum Query - Mutable(树状数组讲解)
Q: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.The update(i, val) function modifies nums by updating the element at index i to val. Example:原创 2016-04-17 15:45:04 · 3221 阅读 · 0 评论 -
(LeetCode 307) Range Sum Query - Mutable(Segment Tree)
Q: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.The update(i, val) function modifies nums by updating the element at index i to val. Example:原创 2016-04-17 15:10:10 · 1136 阅读 · 0 评论 -
分布式服务框架 Zookeeper -- 管理分布式环境中的数据
安装和配置详解本文介绍的 Zookeeper 是以 3.2.2 这个稳定版本为基础,最新的版本可以通过官网 http://hadoop.apache.org/zookeeper/来获取,Zookeeper 的安装非常简单,下面将从单机模式和集群模式两个方面介绍 Zookeeper 的安装和配置。单机模式单机安装非常简单,只要获取到 Zookeeper 的压缩包并解压到某个目转载 2016-11-16 10:53:18 · 411 阅读 · 0 评论