自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

LUCKYOJ

https://github.com/lucky521

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

原创 Euler: Integer right triangles

If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120. {20,48,52}, {24,45,51}, {30,40,50}p是三边长度均为整数的直角三角形的周长,当p=120时,存在三种直角三

2015-05-13 20:27:41 1159

原创 学习JavaScript的闭包

从外部访问函数局部变量变量有局部变量和全局变量。对于函数的局部变量,在函数内部可以访问,在函数外部无法访问。对于全局变量,在函数内部和外部都可以访问。闭包是什么?Javascript允许在函数中定义内部函数,将内部函数返回,这时候会产生闭包。 闭包中含有一种特殊的局部变量,在函数结束返回后仍然存在。 闭包中的局部变量是引用而不是拷贝。返回内部函数function makeFunc() { v

2015-05-12 21:36:15 989

原创 Leetcode: Department Highest Salary

The Employee table holds all employees. Every employee has an Id, a salary, and there is also a column for the department Id.+—-+——-+——–+————–+ | Id | Name | Salary | DepartmentId | +—-+——-+——–+————

2015-03-19 18:10:41 1095

原创 Euler: Non-abundant sums

ProblemA perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which me

2015-03-18 23:05:45 807

原创 Leetcode: Rank Scores

Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking number should be the next consecutive integer value. I

2015-03-18 21:59:05 998

原创 Leetcode: Consecutive Numbers

Write a SQL query to find all numbers that appear at least three times consecutively. +—-+—–+ | Id | Num | +—-+—–+ | 1 | 1 | | 2 | 1 | | 3 | 1 | | 4 | 2 | | 5 | 1 | | 6 | 2 |

2015-03-16 22:20:32 765

原创 Leetcode : Customers Who Never Order

Now we’ve got two table. One customer table for customerid and their names, One Order tablefor customers’ Id that bought something. We will find the customers that in the customer table but not in ord

2015-03-15 22:43:40 734

原创 Leetcode: find all duplicate

Leetcode : Duplicate EmailsWrite a SQL query to find all duplicate emails in a table named Person. +—-+———+ | Id | Email | +—-+———+ | 1 | [email protected] | | 2 | [email protected] | | 3 | [email protected] | +—-+———+

2015-03-15 22:27:45 847

原创 Leetcode: 相关子查询

Leetcode : Employees Earning More Than Their Managers+—-+——-+——–+———–+ | Id | Name | Salary | ManagerId | +—-+——-+——–+———–+ | 1 | Joe | 70000 | 3 | | 2 | Henry | 80000 | 4 |

2015-03-14 19:01:44 725

原创 Leetcode: Second Highest Salary

Write a SQL query to get the second highest salary from the Employee table.+—-+——–+ | Id | Salary | +—-+——–+ | 1 | 100 | | 2 | 200 | | 3 | 300 | +—-+——–+ For example, given the abov

2015-03-14 00:00:58 748

原创 Euler: Digit fifth powers

Problem 30: Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:1634 = 1^4 + 6^4 + 3^4 + 4^4 8208 = 8^4 + 2^4 + 0^4 + 8^4 9474 = 9^4 + 4^4 + 7^4

2015-03-12 19:54:15 701

原创 Euler: Counting Sundays

Problem 19. You are given the following information, but you may prefer to do some research for yourself.1 Jan 1900 was a Monday.Thirty days has September, April, June and November. All the rest hav

2015-03-11 21:07:22 615

原创 Euler: Names scores

Problem 22: Using names.txt, a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this

2015-03-10 22:51:31 690

原创 Euler: Amicable numbers

Amicable numbersThis is the 21st issue of Euler Project Challenge Game.Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).

2015-03-09 19:03:21 1409

原创 Leetcode:Excel Sheet Column Number

Leetcode增加了Accepted Solutions Runtime Distribution,能够看到自己的代码的效率和别人比起来在怎么样的位子。CSDN博客终于推出了Markdown格式写博客。

2015-03-09 17:27:30 1478

原创 数组的最大子数组积 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 large

2014-10-20 10:40:24 1220

原创 寻找循环有序数组的最小值 Find Minimum in Rotated Sorted Array

二分查找是典型的分治思想,主要应用于有序顺组相关的查找问题。典型

2014-10-20 10:14:02 2468

原创 Hadoop系统的守护进程

Hadoop系统在启动有有五个重要的JVM进程,分别是

2014-09-19 16:40:21 1672

原创 看看进程、线程的父子关系

主线程调用pthread_join来等待子线程的结束,然后去ch

2014-09-16 18:52:01 5538

原创 printf趣味程序

下面这个单行程序里包含了不少知识:main() { printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}1:unix默认值main(){ printf(“%d”, unix); }2:数组表示法数组的表示法:str[n]   等价于  (n)[str] ,等价于 str + n,就

2014-08-29 13:48:17 960

原创 学习NoSQL

NoSQL的全称是Not Only SQL,显然是跟数据库存储有关的。

2014-08-28 14:58:29 825

原创 shell登录实现自动交互

每次登录输入密码好麻烦,

2014-06-28 12:11:54 1240

原创 无损数据压缩 Lossless Compression

最近一部叫做《硅谷》的mei'ju

2014-06-10 21:00:46 4634

原创 A-star路径搜索

启发式搜索在于当前搜索结点往下选择下一步结点时,可以通过一个启发函数来进行选择,选择代价最少的结点作为下一步搜索结点而跳转其上。    DFS和BFS在展开子结点时均属于盲目型搜索,它不会选择哪个结点在下一次搜索中更优而去跳转到该结点进行下一步的搜索。与DFS,BFS不同的是,选择的启发函数,可以很快得到一个搜索问题的最优解A*搜寻算法    A*搜寻算法,俗称A星算法,作为启

2014-06-03 10:42:24 1836

原创 KMP算法实现strstr()函数

strStr()函数是C语言库中的字符串匹配函数,函数搜索一个字符串在另一个字符串中的第一次出现。

2014-05-30 10:24:51 3113

原创 Linux下的C语言线程池

线程池的目的是为了减少线程创建、销毁所带来的时空消耗。

2014-05-26 13:05:08 2067

原创 TCP连接的关闭过程

客户端一般是主动关闭方,直接在程序在调用close()函数发出关闭请求(会发送fin报文)。服务器端一般是关闭被动方,不会主动调用close()函数。

2014-05-23 18:55:19 4762

原创 解析XML文件

XML(Extensible Markup Language)是一种标记语言,被设计用来传输和存储数据,而不是用于显示数据。它和JSON(JavaScript Object Notation)的作用是一致的。既然XML的作用在于传送数据,那么两件重要的事情就是XML的生成和解析这两个逆向的过程。XML的文件格式由W3C指定统一的标准,不管什么编程语言,只要按照其标准进行,就可以正确的生

2014-05-15 20:09:43 930

原创 判断平面上一点是否在三角形内 Inside a triangle or not

平面内有一个三角形,三个顶点的坐标已经给出。现在给出一个坐标点,

2014-05-14 21:14:39 1976

翻译 Python编程中容易出现的10个错误

Python是一个解释型、面向对象、具有动态语义的高级语言。它具有高级数据结构、动态类型绑定,支持模块化。由于Python程序员往往并非只会这一门语言,受其他语言的影响,我们在编写Python代码的时候容易出现一些错误,本文中列出了10点。一、函数参数默认值Python允许定义函数参数的默认值,这和C/C++是一致的。但是所不同的是,解释器只对该默认参数赋值一次。

2014-05-10 22:28:24 1851

原创 实现线程读写锁的四种方法

对于某个临界互斥资源,读写锁:当已经被加了读锁时,其他的读模式锁请求仍然可以访问,但是写模式锁不能访问;当写模式锁加锁时,其他的请求都不能访问。

2014-05-07 21:19:15 13300 3

原创 标准模板库的空间配置器 STL's allocator

标准模板库中利用空间配置器来在幕后管理内存空间,有下面两种空间配置器。一种是标准的空间配置器std:allocator一种是高级的空间配置器std:alloc

2014-05-04 22:38:26 1020

原创 估算圆周率 Estimate PI

本文介绍了一种估算圆周率的非常简单的

2014-05-03 22:47:00 2441

原创 等概率选取问题 Random Pick

等概率选取问题要求保证选取的随机性,即

2014-05-03 13:33:44 3444

原创 阿拉伯数字转换为汉语表达方式

汉语博大精深,讲一个简单的阿拉伯数字转换为我们比如 1980,要转换为“一千九百八十”;198 要转换为“一百九十八”;19 要转换为“十九”,1要转换为“一”。数值:零一二三四五六七八九小权值:十 百 千 大权值:万 亿特殊用例:1、注意0的出现。1080、1008、1800、10000、1000000、100000000。2、如果某个大权值内的四位都是0

2014-05-01 18:43:35 2536

原创 关注健康

明天国际劳动节了,发一篇没技术的文章吧。

2014-04-30 21:09:08 849

原创 C++的虚函数 Virtual Function

virtual有两个用处。 一个是最常见的: virtual关键字修饰类的成员函数。另一个是虚基类机制,用于多重继承。在定义派生类时,要在基类描述前加关键字virtual。避免内存中父虚基类成员的重复放置。虚函数:定义:虚函数必须是类的 非静态成员函数 且 非构造函数,其访问权限是public(可以定义为private or proteceted,但是对于多

2014-04-29 16:26:56 1101

原创 生产者-消费者的问题

生产者-消费者问题是最经典的操作系统同步与互斥相结合的wen

2014-04-27 18:04:37 1175

原创 命令行参数和变长参数表

命令行参数作为程序的输入数据,

2014-04-25 20:36:47 992

原创 TCP的网络连接建立过程

套接字描述符套接字描述符是int类型的。套接字描述符是文件描述符的一种,是UNIX系统中内核对各种类型文件的标识。网络地址结构体sockaddr_in结构体struct sockaddr_in {     short sin_family; /* Address family 一般来说 AF_INET(地址族)PF_INET(协议族 )*/

2014-04-24 09:43:21 1788 1

空空如也

空空如也

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

TA关注的人

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