自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

努力奋斗

道阻且长 行则将至

  • 博客(47)
  • 资源 (6)
  • 问答 (2)
  • 收藏
  • 关注

原创 Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with

2016-04-28 11:22:37 331

原创 Plus One

题目:Given a non-negative number represented as an array of digits, plus one to the number.          The digits are stored such that the most significant digit is at the head of the list.含义:尼玛!!

2016-04-27 18:40:33 411

原创 Java StringBuilder 与 StringBuffer

一、Java String 类——String字符串常量 字符串广泛应用 在Java 编程中,在 Java 中字符串属于对象,Java 提供了 String 类来创建和操作字符串。需要注意的是,String的值是不可变的,这就导致每次对String的操作都会生成新的String对象,这样不仅效率低下,而且大量浪费有限的内存空间。我们来看一下这张对String操作时内存变化的图:二、...

2016-04-27 15:09:10 370

原创 Vmstat 2 详解

查看服务器状态vmstat是一个查看虚拟内存(Virtual Memory)使用状况的工具,使用vmstat命令可以得到关于进程、内存、内存分页、堵塞IO、traps及CPU活动的信息。本文介绍了虚拟内存的运行原理,继而介绍了vmstat的用法和使用范例。===================================================例子1:每2秒输出一条结果

2016-04-27 13:03:48 3124

原创 Ubuntu磁盘分区

1、显示硬盘及所属分区情况。在终端窗口中输入如下命令:      sudo fdisk -lu2、查看硬盘剩余空间dfdf --help 显示帮助查看目录占用空间du -hs 目录名========================================查看块设备lsblk查看硬盘的分区sudo fdisk -l硬盘分区#

2016-04-26 19:04:21 604

转载 Mysql数据库备份和还原常用的命令

摘要:备份MySQL数据库的命令 mysqldump -hhostname -uusername -ppassword databasename backupfile.sql 备份MySQL数据库为带删除表的格式 备份MySQL数据库为带删除表的格式,能够让该备份覆盖已有数据库而不需要手动删备份MySQL数据库的命令mysqldump -hhostname -uusername

2016-04-25 16:23:34 386

转载 MySQL数据库管理常用命令

摘要:[导读]MySQL数据库管理常用命令。 安装利用RPM包安装Mysql 设置TCP 3306端口的iptables root密码管理设置root用户的密码mysqladmin -uroot password 'password' 修改root用户的密码mysqladmin -uroot -p password 'password'导读:MySQL数据库管理常用命令。安装利

2016-04-25 16:21:33 383

转载 Git常用命令和Git团队使用规范指南

前言在2005年的某一天,Linux之父Linus Torvalds 发布了他的又一个里程碑作品——Git。它的出现改变了软件开发流程,大大地提高了开发流畅度,直到现在仍十分流行,完全没有衰退的迹象。其实一般情况下,只需要掌握git的几个常用命令即可,但是在使用的过程中难免会遇到各种复杂的需求,这时候经常需要搜索,非常麻烦,故总结了一下自己平常会用到的git操作。本文根据团队实践记录G

2016-04-25 16:16:35 641

原创 最大公因数、最小公倍数---by 渔陽

写个简单点的吧,陶冶一下情操!!!最大公因数://最大公因数if (m < n) { int t = n; n = m; m = t;}while (m % n != 0) { int r = m % n; m = n; n = r;}最小公倍数:if(m

2016-04-22 15:45:05 641

转载 Best Time to Buy and Sell Stock

题目: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

2016-04-22 12:37:56 279

原创 判断一个非负整数是否为2的n次幂?-by大彬

Given an integer, write a function to determine if it is a power of two.Credits:Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.===============

2016-04-22 11:17:54 679

原创 Happy Numbe

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 o...

2016-04-21 19:26:09 367

原创 Power of Three ,判断一个数是否为3的n次幂

Given an integer, write a function to determine if it is a power of three.Follow up:Could you do it without using any loop / recursion?=========================================常规方法==========

2016-04-21 18:50:00 3763

原创 Ugly Number

//丑数就TM丑所谓一个数m是另一个数n的因子,是指n能被m整除,也就是n % m == 0。根据丑数的定义,丑数只能被2、3和5整除。也就是说如果一个数如果它能被2整除,我们把它连续除以2;如果能被3整除,就连续除以3;如果能被5整除,就除以连续5。如果最后我们得到的是1,那么这个数就是丑数,否则不是。 Write a program to check whether

2016-04-21 18:10:42 329

原创 爬楼梯的问题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?Subscribe to see which c

2016-04-21 17:36:38 743 1

原创 删除有序链表中的重复节点

//表示对递归掌握的不是很熟,链表的操作好多都是递归实现!!!是时候好好学学递归了 Remove Duplicates from Sorted List   Given a sorted linked list, delete all duplicates such that each element appear only once.For example

2016-04-21 17:12:15 966

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

2016-04-21 16:57:03 398

转载 罗马数字与整数相互的转换

第13题:整数转换成罗马数字&第14题:罗马数字转换成整数写在前面:这两道题合起来写吧,其实整数转罗马数字我前天就写完了,当我想写罗马数转整数的时候竟然脑子一片空白,想了几分钟就想起来Map,本着学习的目的最终还是不想用Map,坚持C语言,今天脑子里直接涌出了Switch方式转换,看来“蹲在马桶上编程”的方式还是蛮不错的o(^▽^)o整数转罗马数字:主要建立对应

2016-04-21 15:23:58 2396

转载 找出数组中两个只出现一次的数字

题目:一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。要求时间复杂度是O(n),空间复杂度是O(1)。 因为空间复杂度是1.。。。。不能用HashMap 异或运算的性质:任何一个数字异或它自己都等于0 简单版本:一个数组里除了一个数字之外,其他的数字都出现了两次。请写程序找出这个只出现一次的数字 有了上面简单问题的解决方案

2016-04-20 22:54:47 812

原创 找出来单个数据

存在一个数组,数组大小为2n+1,里面有n对个数,加上另外一个单独出现的数,例如:1,2,2,3,1.(数组是无序的,考虑排序的话一定会超过限制)这5个数中的单独的数就是3,要你用你能想到的最高效率的方法找出来。=====================================int testData[]={1,2,2,3,1};int data=0; for(in

2016-04-20 15:41:41 355

原创 Given an array of size n, find the majority element. The majority element is the element that appear

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

2016-04-20 14:18:07 913

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

2016-04-20 12:20:39 348

原创 char 类型转换成ascii码值

char a='2';char b='A';System.out.println(Integer.parseInt(a+""));System.out.println(Character.valueOf(b)+0);System.out.println(b+0);

2016-04-20 11:55:00 7195

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

2016-04-20 11:22:10 350

原创 判断二叉树是否相等

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.Subscr

2016-04-20 11:00:35 587

原创 Given two strings s and t, write a function to determine if t is an anagram of s.

Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You may a

2016-04-19 23:28:09 858

原创 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 with value

2016-04-19 19:53:49 372

原创 Given an array nums, write a function to move all 0's to the end of it while maintaining the relativ

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 calling you

2016-04-19 19:43:59 1703

原创 二叉树最大深度的值

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Subscribe to see which compani

2016-04-19 15:49:12 434

原创 Given a non-negative integer num, repeatedly add all its digits until the result has only one digit

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on

2016-04-19 15:30:35 1577

原创 Nim games 博弈论

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the

2016-04-19 15:05:32 438

原创 leetCode Given an integer (signed 32 bits), write a function to check whether it is a power of 4

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

2016-04-19 12:17:20 958

原创 java中常用的几种设计模式

1.单例模式(有的书上说叫单态模式其实都一样)该模式主要目的是使内存中保持1个对象。看下面的例子:package org.sp.singleton;//方法一public class Singleton {//将自身的实例对象设置为一个属性,并加上Static和final修饰符private static final Singleton instance = n

2016-04-18 17:59:06 518

原创 ArrayList和Vector的区别,HashMap和Hashtable的区别

ArrayList和Vector都是使用数组方式存储数据,此数组元素数大于实际存储的数据以便增加和插入元素,它们都允许直接按序号索引元素,但是插入元素要涉及数组元素移动等内存操作,所以索引数据快而插入数据慢,Vector由于使用了synchronized方法(线程安全),通常性能上较ArrayList差。HashMap是Hashtable的轻量级实现(非线程安全的实现),他们都完成了Map接口

2016-04-18 17:40:12 558

原创 short s1 =1; s1 = s1 + 1;有什么错? short s1 = 1; s1 += 1;有什么错;float型float f=3.4是否正确?

short s1 =1; s1 = s1 + 1;有什么错? short s1 = 1; s1 += 1;有什么错?short s1=1; s1=(short)(s1+1); s1+=1;short s1 = 1; s1 = s1 + 1; (s1+1运算结果是int型,需要强制转换类型) short s1 = 1; s1 += 1;(可以正确编译)

2016-04-18 17:35:55 1182

原创 java实现冒泡排序

/** * 对int数组进行升序排序 * * @param sort[]:待排序的数组 * @param asc_type:值为true,表示升序排序;传入值为false,表示降序排序 * @return 返回排序后的int数组 */ public int[] bubble_sort(int sort[],boole...

2016-04-18 17:28:05 451

原创 public,private,protected,defalut

访问 Public Protected 缺省的 Private同类 √ √√ √同包 √ √√ ×子类 √ √× ×通用性 √ ×× ×

2016-04-18 16:51:51 514

原创 int 和 Integer 有什么区别

Java 提供两种不同的类型:引用类型和原始类型(或内置类型)。Int是java的原始数据类型,Integer是java为int提供的封装类。Java为每个原始类型提供了封装类。原始类型封装类booleanBoolean  charCharacter  byteByte  shortShort  intInteger  longLong  floatFloat  doubleDou

2016-04-18 16:39:15 453

原创 面向对象的特征有哪些方面

1)抽象:抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面。抽象并不打算了解全部问题,而只是选择其中的一部分,暂时不用部分细节。抽象包括两个方面,一是过程抽象,二是数据抽象。2)继承:继承是一种联结类的层次模型,并且允许和鼓励类的重用,它提供了一种明确表述共性的方法。对象的一个新类可以从现有的类中派生,这个过程称为类继承。新类继承了原始类的特性,

2016-04-18 16:35:06 442

原创 abstract class和interface有什么区别?

Interface只能有成员常量,只能是方法的声明;而abstract class可以有成员变量,可以声明普通方法和抽象方法。声明方法的存在而不去实现它的类被叫做抽象类(abstract class),它用于要创建一个体现某些基本行为的类,并为该类声明方法,但不能在该类中实现该类的情况。不能创建abstract 类的实例。然而可以创建一个变量,其类型是一个抽象类,并让它指向具体子类的一个实

2016-04-18 16:28:26 387

sagas英文原版下载

Hector Garcaa-Molrna 、Kenneth Salem Saga模型起源于1987年 Department of Computer Science Princeton University Princeton, N J 08544

2020-12-14

Java8新特性知识梳理

码字不易,共勉~ Java 8 API添加了一个新的抽象称为流Stream,可以让你以一种声明的方式处理数据。

2020-11-24

chrom添加身份验证器authenticator插件

亲测可用的身份验证器插件,安装简单方便,只需要下载到本地,之后拖拽到扩展呈现的开发者模式即可,预祝你身份验证器安装顺利!

2020-11-11

chrom添加cookie插件

亲测可用的cookie插件,安装简单方便,只需要下载到本地,之后拖拽到扩展呈现的开发者模式即可,预祝你cookie安装顺利!

2020-11-11

windows下搭建SVN

对初学者来说SVN的配置在windows下是非常的苦难的,这个帮助文档将会非常方便的给大家一个搭建svn的方便的方法。

2015-04-16

初学者linux的学习资料

由于初学者对linux的命令行的操作感觉是那么的神圣和复杂,在这篇学习资料中你会发现linux也不过如此,轻松的拿下!

2015-04-16

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

TA关注的人

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