自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

ultrapp的专栏

寻求编程和生活之美~

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

原创 leetcode 100. Same Tree

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.Subscribe to

2016-07-21 18:37:57 242

原创 leetcode 238. Product of Array Except Self

Given an array of n integers where n > 1, nums, return an arrayoutput such that output[i] is equal to the product of all the elements ofnums except nums[i].Solve it without division and in O(n).

2016-07-21 18:06:55 241

原创 leetcode 237. 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-07-21 17:43:29 247

原创 leetcode 349. Intersection of Two Arrays

Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return[2].Note:Each element in the result must be unique.The result c

2016-07-21 17:38:55 197

原创 leetcode 376. Wiggle Subsequence

A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either pos

2016-07-21 17:26:11 1402 1

原创 leetcode 283. Move Zeroes

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 your fu

2016-07-21 16:37:06 196

原创 leetcode 260. Single Number III

Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:Given nums =

2016-07-21 16:35:33 215

原创 leetcode 226. Invert Binary Tree

Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by this original tweet by Max Howe

2016-07-21 15:45:32 170

原创 leetcode 104. Maximum Depth of Binary Tree

104. Maximum Depth of Binary TreeTotal Accepted: 160295Total Submissions: 328352Difficulty: EasyGiven a binary tree, find its maximum depth.The maximum depth is the numbe

2016-07-21 15:42:22 255

原创 leetcode 258

258. Add DigitsTotal Accepted: 110807Total Submissions: 224904Difficulty: EasyGiven a non-negative integer num, repeatedly add all its digits until the result has only one

2016-07-21 15:35:49 213

原创 leetcode 136

136. Single NumberTotal Accepted: 139245Total Submissions: 273783Difficulty: MediumGiven an array of integers, every element appears twice except for one. Find that single

2016-07-21 15:30:57 228

原创 leetcode 371

371. Sum of Two IntegersTotal Accepted: 15459Total Submissions: 29688Difficulty: EasyCalculate the sum of two integers a and b, but you are not allowed to use the operato

2016-07-21 15:17:25 177

原创 leetcode 7

7. Reverse IntegerTotal Accepted: 152273Total Submissions: 640718Difficulty: EasyReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -3

2016-07-21 14:58:06 212

原创 leetcode 231

231. Power of TwoTotal Accepted: 86376Total Submissions: 228380Difficulty: EasyGiven an integer, write a function to determine if it is a power of two.Credits:Special t

2016-07-21 14:09:22 248

转载 libcurl 使用说明和网页抓取 linux下的curl编程

1         LibCurl简介LibCurl是免费的客户端URL传输库,支持FTP,FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, FILE ,LDAP等协议,其主页是http://curl.haxx.se/。Libcurl具备线程安全、IpV6兼容、易于使用的特点。本文档主要介绍LibCurl在http协议方面的应用。1.1HT

2015-11-18 11:22:51 2473

原创 glibc detected

linux c编程错误集:一次在一个函数里面想累计一个链表的长度,在一次重新合并成一个节点,出现了如下错误。乍一看,密密麻麻,很恐怖。提示也不够具体,而且这是使用gcc -g *** 编译出来的结果,仍然没有提示出错的位置。细细分析可知,glibc是linux GNU C的函数库。而后面malloc也提示了是malloc的调用出现了m

2015-10-27 11:24:00 1275

转载 增加vim y命令的最大复制行数

转自:http://tonykorn97.itpub.net/post/6414/252226 在编辑文件之后退出时,vi(vim)提示”Can’t write viminfo file”错误,了解一下viminfo文件:信息文件 viminfo 被设计为储存状态信息:命令行和模式搜索的历史记录寄存器内文本各种文件的标记缓存器列表全局变量

2015-10-12 14:57:40 2376

转载 makefile编写

makefile很重要      什么是makefile?或许很多Winodws的程序员都不知道这个东西,因为那些Windows的IDE都为你做了这个工作,但我觉得要作一个好的和professional的程序员,makefile还是要懂。这就好像现在有这么多的HTML的编辑器,但如果你想成为一个专业人士,你还是要了解HTML的标识的含义。特别在Unix下的软件编译,你就不能不自己写make

2015-10-12 10:53:03 294

原创 windows连接代理服务器,总是弹出输入用户名和密码的框的问题

win7连接代理服务器,总是弹出输入用户名和密码的框的问题 .  1. 首先确认一下控制面板-系统和安全-windows防火墙-允许的程序里打开了"文件和打印机共享"  2. 开始=>运行... =>gpedit.msc=>本地计算机策略=>计算机配置=>Windows设置=>安全设置=>本地策略=>安全选项.找到:"网络安全:LAN管理器身份验证级别"项,默认值"没有定义"改为"发送LM

2015-10-08 09:29:31 11544

原创 通过反汇编一个简单的C程序,分析汇编代码理解计算机是如何工作的(原创)

首先编写c程序代码:main.cint g(int x){  return x + 16;} int f(int x){  return g(x);} int main(void){  return f(64) + 155;}然后使用下面的指令进行编译和汇编:gcc -S -o main.s main.c -m

2015-08-16 22:30:27 1144

转载 基本内部排序算法-c语言

概述排序有内部排序和外部排序,内部排序是数据记录在内存中进行排序,而外部排序是因排序的数据很大,一次不能容纳全部的排序记录,在排序过程中需要访问外存。我们这里说说八大排序就是内部排序。        当n较大,则应采用时间复杂度为O(nlog2n)的排序方法:快速排序、堆排序或归并排序序。   快速排序:是目前基于比较的内部排序中被认为是最好的方法,

2015-07-11 10:42:23 509

转载 jvm 剖析

从Java平台的逻辑结构上来看,我们可以从下图来了解JVM:从上图能清晰看到Java平台包含的各个逻辑模块,也能了解到JDK与JRE的区别对于JVM自身的物理结构,我们可以从下图鸟瞰一下:对于JVM的学习,在我看来这么几个部分最重要:Java代码编译和执行的整个过程JVM内存管理及垃圾回收机制下面将这两个部分进行详细学习Java代码编译是由Java源码编译器来完

2015-06-17 15:12:38 325

原创 java各类型的最大值

public class test2{   public static void main(String args[])   {    long long_max=java.lang.Long.MAX_VALUE;//得到长整型的最大值。    int int_max=java.lang.Integer.MAX_VALUE;//得到整型的最大值。 

2015-06-11 10:06:16 618

转载 (JAVA)截取中英文混合字符串

题目:编写一个截取字符串的函数,输入为一个字符串和字节数,输出为按字节截取的字符串。 但是要保证汉字不被截半个,如“我ABC”4,应该截为“我AB”,输入“我ABC汉DEF”,6,应该输出为“我ABC”而不是“我ABC+汉的半个”。GB2312、GBK、GB18030,CP936以及CNS11643都满足条件 -- 中文是占用2个字节的,英文是占用1一个字节 。中文编码资料

2015-06-10 22:50:13 645

原创 申请baidu地图 sdk,获取sha1步骤

1.申请sha1 key:方法1:控制台进入 .android 文件夹,输入命令keytool -list -keystore debug.keystore方法2:从 eclipse 的 adt里面找到android的设置,查看sha1的值如下:2.获取包名:在androidmanifest.xml里面的在manifest标签里面的包名。获取到~

2015-06-10 14:51:08 543

转载 android xml 的解析.

1.普通型Xml代码  xml version=”1.0″ ?>  statuses>  status>  source1>asource1>  source2>asource2>  source2>asource2>  status>  statuses>  xml>   解析代码.Java代

2015-06-09 18:45:05 336

原创 java ArrayList<String> 与 string数组的相互转换

list 转 数组:ArrayList list=new ArrayList();//list.add("something"); 把list存储一些数据String[] str= new String[list.size()];list.toArray(str);数组 转list:List list = new ArrayList();St

2015-06-09 10:15:04 717

转载 android sqlit增删改查

一、使用嵌入式关系型SQLite数据库存储数据在Android平台上,集成了一个嵌入式关系型数据库——SQLite,SQLite3支持NULL、INTEGER、REAL(浮点数字)、 TEXT(字符串文本)和BLOB(二进制对象)数据类型,虽然它支持的类型只有五种,但实际上sqlite3也接受varchar(n)、 char(n)、decimal(p,s) 等数据类型,只不过在运算或保存时

2015-06-08 17:39:30 810

转载 Android charsequence

CharSequence类型这是一个接口,代表的是一个有序字符集合,这个接口包含的方法有:charAt(int index),toString(),length(),subSequence(int start,int end).这里需要说的一点就是,对于一个抽象类或者是接口类,不能使用new来进行赋值,但是可以通过以下的方式来进行实例的创建:CharSequence cs="hello

2015-06-08 16:50:23 490

原创 监听 editText状态

package com.android.text; import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.widg

2015-06-08 16:42:49 364

转载 Android EditText聚焦时hint消失的简单代码

mInfo = (EditText) findViewById(R.id.fabu_info);mInfo.setOnFocusChangeListener(new OnFocusChangeListener() {    public void onFocusChange(View v, boolean hasFocus) {        EditText _v=(EditText

2015-06-08 16:22:06 344

转载 android 设置EditText光标位置

Android中有很多可编辑的弹出框,其中有些是让我们来修改其中的字符,这时光标位置定位在哪里呢?刚刚解了一个bug是关于这个光标的位置的,似乎Android原生中这种情况是把光标定位到字符串的最前面。需求是将光标定位到字符的最后面。修改的地方是TextView这个控件,因为EditText也是继承了TextView。在setText方法中有:1  private void

2015-06-08 16:18:18 463

转载 android:padding和android:layout_margin的区别?

android:layout_margin就是设置view的上下左右边框的额外空间android:padding是设置内容相对view的边框的距离 在LinearLayout、RelativeLayout、TableLayout中,这2个属性都是设置都是有效的在FrameLayout中,android:layout_margin是无效的,因为FrameLayout里面的

2015-06-08 15:51:55 353

转载 Android 控件之ProgressBar进度条

ProgressBar是Android的进度条。体验效果 源码下载下面详细介绍ProgressBar一、说明  在某些操作的进度中的可视指示器,为用户呈现操作的进度,还它有一个次要的进度条,用来显示中间进度,如在流媒体播放的缓冲区的进度。一个进度条也可不确定其进度。在不确定模式下,进度条显示循环动画。这种模式常用于应用程序使用任务的长度是未知的。二、

2015-06-08 15:36:44 294

空空如也

空空如也

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

TA关注的人

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