lichao_normal

导航

11 2016 档案

Divide Two Integers
摘要:1 int divide(int dividend, int divisor) { 2 if(divisor==0)return INT_MAX; 3 if(dividend==0)return 0; 4 long long res=0; 5 int flag=1; 6 long long d1=d 阅读全文

posted @ 2016-11-26 22:31 lichao_normal 阅读(168) 评论(0) 推荐(0)

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 fo 阅读全文

posted @ 2016-11-26 15:16 lichao_normal 阅读(190) 评论(0) 推荐(0)

Reverse Nodes in k-Group
摘要:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then l 阅读全文

posted @ 2016-11-25 22:45 lichao_normal 阅读(71) 评论(0) 推荐(0)

Generate Parentheses
摘要:问题是给定n对的圆括号,产生所有正确顺序的或括号排列序列。 首先明确第一个出现的一定是左括号,而以后的则是可以出现左也可以出现右。 则n=1时: 当n=2时: 当n=3时: 由此可见,很明显的树形结构,所有的排列顺序,就是对树进行的一次dfs,所以借用dfs的算法就可以完成。 void genera 阅读全文

posted @ 2016-11-25 17:13 lichao_normal 阅读(95) 评论(0) 推荐(0)

4Sum
摘要:4sum算法: 这一类的算法要想进行时间复杂度的缩减,都必须先将数组进行简单的排序。然后依次固定两个数据,再对剩余的数据进行从两端开始的循环,固定的连个数据加上剩余数据的两端的数据之和等于目标数据的时候,说明查找成功,保存记录。当小于目标数据时,已经知道数据是有序的(假定是升序排列),低位坐标low 阅读全文

posted @ 2016-11-24 17:56 lichao_normal 阅读(97) 评论(0) 推荐(0)

Letter Combinations of a Phone Number
摘要:import java.awt.BufferCapabilities; import java.util.ArrayList; import java.util.List; public class Solution { public List<String> letterCombinations( 阅读全文

posted @ 2016-11-24 15:24 lichao_normal 阅读(72) 评论(0) 推荐(0)

zigzag convert
摘要:char* convert(char* s, int numRows) { if(numRows<=1||strlen(s)<numRows)return s; char *res=(char*)malloc(sizeof(char)*(strlen(s)+1)); int flag=0; int 阅读全文

posted @ 2016-11-22 16:18 lichao_normal 阅读(92) 评论(0) 推荐(0)

android Fragment
摘要:fragment做为android中activity的一个重要的组成部分,它理解起来相当简单。如果学习过html的知道,在html中也有一个标签叫fragment,它的作用是嵌入一个html文件,所以activity中的fragment也是一样的,它是activity的组成部分,每个fragment 阅读全文

posted @ 2016-11-22 16:08 lichao_normal 阅读(101) 评论(0) 推荐(0)

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 int 阅读全文

posted @ 2016-11-21 16:50 lichao_normal 阅读(152) 评论(0) 推荐(0)

Intent 类型
摘要:intent是一个消息传递对象,你可以使用它从其他应用组件请求操作。intent的常用操作。 启动Activity activity已知是一个android的一个界面,通过调用startActivity(),我们可以启动一个新的activity,并且实现界面的跳转。并且可以传递一些简单的数据。 如果 阅读全文

posted @ 2016-11-19 14:11 lichao_normal 阅读(259) 评论(0) 推荐(0)

Android 入门第一个demo
摘要:建立一个简单的用户接口 使用android studio建立一个布局xml文件,在这个布局文件中我们将一些简单的组件添加到用户界面中,特别值得注意的是android中一个Activity代表的就是一个用户界面,也就是手机屏幕上显示的内容。建立一个空白的linear layout就相当于建立了手机上一 阅读全文

posted @ 2016-11-18 13:17 lichao_normal 阅读(252) 评论(0) 推荐(0)