自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(46)
  • 收藏
  • 关注

原创 LeetCode------Remove Duplicates from Sorted List

题目简介Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.题目的意识是给一个已经排好序链表,删除重复的元素。

2016-05-07 20:09:48 451

原创 LeetCode------Majority Element

题目简介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 always exist in the array.题目的意思是找出一个数组中出现次数超过⌊ n/2 ⌋次

2016-05-06 22:13:13 381

原创 LeetCode------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?题目的意思就是一个数字n,你可以用1或2,总共有多少种组合方式

2016-05-05 22:19:01 516

原创 LeetCode------Linked List Cycle

题目简介Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题意就是让我们判断一个链表是否有循环,而且不能开辟额外的空间

2016-05-04 21:35:30 454

原创 LeetCode------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 00000000000000000000000000001011, so the function should ret

2016-05-03 21:59:11 355

原创 LeetCode------Lowest Common Ancestor of a Binary Search Tree

题目简介Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes v and w as the lowest node in T that has

2016-05-03 10:53:14 420

原创 Android Studio 如何在res目录下新建layout-large目录

今天学习到了fragment其中有一部分讲的是使用限定符达到屏幕适配的问题,比如我们要使我们的app适配平板等高分辨率设备,首先要在res目录下新建layout-large目录。在Android Studio的操作应该是右键res->new->Directory,然后输入layout-large,点击ok。然后我们以为已经新建好了,但是刷新了很多遍,还是没有看到这个目录。自己跑到工作目录下找了一下

2016-05-02 16:09:42 12332 3

转载 Android 一张图理解getWidth和getMeasuredWidth

view.getMeasuredHeight()可能隐藏在上头.可能在下头.如果view没有超出屏幕的时候view.getMeasuredHeight() 有可能小于 view.getHeight()   getWidth(): View在设定好布局后整个View的宽度。   getMeasuredWidth(): 对View上的内容进行测量后得到的View内容占据的宽度

2016-05-02 12:56:41 567

原创 LeetCode------Roman to Integer

题目简介Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.

2016-05-01 21:54:55 346

转载 setContentView、findViewById 和 inflate 的区别?

通俗的说,inflate就相当于将一个xml中定义的布局找出来.因为在一个Activity里如果直接用findViewById()的话,对应的是setConentView()的那个layout里的组件.因此如果你的Activity里如果用到别的layout,比如对话框上的layout,你还要设置对话框上的layout里的组件(像图片 ImageView,文字TextView)上的内容,

2016-04-29 22:22:08 401

原创 LeetCode------Contains Duplicate

题目简介Reverse a singly linked list.click to show more hints.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?自己的解法//

2016-04-29 21:24:04 341

转载 ANDROID L——RecyclerView,CardView导入和使用(Demo)

简介:这篇文章是ANDROID L——Material Design详解(UI控件)的一个补充或者说是应用实例,如果有时间建议大家稍微浏览一下上篇文章。本文主要介绍Android L新增加的两个UI控件RecyclerView,CardView的导入和使用。RecyclerView是ListView的升级版CardView则是Google

2016-04-29 16:07:37 598

原创 【错误反思】 android.content.res.Resources$NotFoundException

写了一个关于LIstView小应用,在启动时一直闪退。提示我错误是android.content.res.Resources$NotFoundException定位到了这一行 view = LayoutInflater.from(getContext()).inflate(resourceId, null);刚开始找了半天找不到错误的原因,查了一下网上的资料最大的错误可能是

2016-04-28 21:49:12 531

原创 LeetCode------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 ever

2016-04-28 20:28:26 385

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

2016-04-28 12:24:44 422

原创 LeetCode------Valid Anagram

题目简介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

2016-04-26 20:52:36 858

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

2016-04-25 21:42:03 387

原创 LeetCode------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 n

2016-04-25 20:31:49 436

原创 LeetCode------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], aft

2016-04-24 19:47:24 348

转载 最详细的 Android Toolbar 开发实践总结

初识 ToolbarToolbar是在 Android 5.0 开始推出的一个 Material Design 风格的导航控件 ,Google 非常推荐大家使用 Toolbar 来作为Android客户端的导航栏,以此来取代之前的 Actionbar 。与 Actionbar 相比,Toolbar 明显要灵活的多。它不像 Actionbar 一样,一定要固定在Activity的顶部,而是可

2016-04-21 21:32:18 574

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

2016-04-21 21:15:04 490

原创 LeetCode------Maximum Depth of Binary Tree

题目简介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.自己的解法

2016-04-20 21:35:05 471

转载 Android Studio 快捷键大全及使用技巧

Alt+回车 导入包,自动修正Ctrl+N   查找类Ctrl+Shift+N 查找文件Ctrl+Alt+L  格式化代码Ctrl+Alt+O 优化导入的类和包Alt+Insert 生成代码(如get,set方法,构造函数等)Ctrl+E或者Alt+Shift+C  最近更改的代码Ctrl+R 替换文本Ctrl+F 查找文本Ctrl+Shift+Space 自动

2016-04-19 21:27:23 15025

原创 LeetCode------Add Digits

题目简介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. Si

2016-04-19 20:52:38 388

原创 LeetCode------Nim Game

题目介绍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 w

2016-04-18 20:32:04 388

原创 LeetCode------ZigZag Conversion

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S

2016-04-17 21:25:15 493

转载 android应用中去掉标题栏的方法

在android中去掉标题栏有三种方法,它们也有各自的特点。1.在代码里实现[java] view plain copythis.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏  记住:这句代码要写在setContentView()前面。2.在清单文件(man

2016-04-17 12:36:43 551

原创 LeetCode------Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "

2016-04-16 21:31:12 488

转载 关于androidManifest.xml的概叙以及intent-filter的详细分析

AndroidManifest.xml配置文件对于Android应用开发来说是比较细但又很重要的基础知识,本文旨在总结该配置文件中常用到的几个属性,以便日后查阅,至于那些比较细的属性,主要是平时开发比较少用便不列举,如果自己有需要直接在eclipse中直接“alt+/”就好了……下面是一个比较通用的AndroidManifest.xml文件样例(所建的工程目录是Test),<mani

2016-04-09 13:52:09 631

原创 LeetCode------Add Two Numbers

题目说明You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it

2016-04-07 20:29:00 330

原创 LeetCode------Two Sum

题目说明Given an array of integers, return indices of the two numbers such that they add up to a specific target. 给定一个整数的数组,将它们添加到一个特定的目标的2个数字的返回值。 You may assume that each input would have exactl

2016-04-05 22:04:32 256

转载 android客户端与服务器端交互 如何保持session

最近在开发项目的过程中,遇到android与web服务器要在同一session下通信的问题。 在解决问题前先回顾下Session与Cookie: Cookie和Session都为了用来保存状态信息,都是保存客户端状态的机制,它们都是为了解决HTTP无状态的问题而所做的努力。 Session可以用Cookie来实现,也可以用URL回写的机制来实现。 Cookie和Session有以下明显的不同

2016-04-05 13:06:10 1647

原创 最近一段时间的笔试心得(阿里,网易,华为)

到了大三下学期,开始要找实习了。= =刚开始做安卓开发水平还比较渣,但觉得实习生的要求可能没有那么高。抱着试一试的心态投了阿里,网易,腾讯和华为。接下来就讲讲的我自己的一些体会。阿里之前认识一个学长在阿里,所以叫他帮忙内推了客户端的开发工程师。不是内推的话好像还要笔试……内推完了之后天天等电话查简历。之前看到网站上许多人的经历,感觉一面电话面试的问题还是比较难的,所以还是在认真复习(不过没报什么希望

2016-03-31 21:41:36 15307 1

转载 Android客户端与服务器交互中的token

学习TokenToken是什么?Token是服务端生成的一串字符串,以作客户端进行请求的一个令牌,当第一次登录后,服务器生成一个Token便将此Token返回给客户端,以后客户端只需带上这个Token前来请求数据即可,无需再次带上用户名和密码。Token的引入——Token是在客户端频繁向服务端请求数据,服务端频繁的去数据库查询用户名和密码并进行对比,判断用户名和密码正确与否,并作出相应提示,在这样

2016-03-29 15:25:05 692

原创 利用遗传算法求解车辆路径问题

1. 车辆问题描述车辆路线问题(VRP)最早是由Dantzig和Ramser于1959年首次提出,它是指一定数量的客户,各自有不同数量的货物需求,配送中心向客户提供货物,由一个车队负责分送货物,组织适当的行车路线,目标是使得客户的需求得到满足,并能在一定的约束下,达到诸如路程最短、成本最小、耗费时间最少等目的。 车辆路线问题自1959年提出以来,一直是网络优化问题中最基本的问题之一,由于其应用的广

2016-03-21 13:09:20 35193 6

原创 基于dos的多任务系统实现

一.程序的设计思想该程序主要是分5大块内容:线程的创建和撤销,线程的调度,线程的同步与互斥,线程的阻塞与唤醒,利用消息缓冲队列的线程间的通信。由这五大块功能来完成的基于DOS的多任务系统的实现。在这个系统中,首先先由main函数进行一些初始化工作,然后直接创建0#线程对应于main函数,再由0#线程调用create创建1#,2#线程分别对应与函数f1(),f2(),最后将系统的中断服务程序设置为ne

2016-03-20 21:43:42 1541

原创 网易2016研发工程师编程题②

第一题小v今年有n门课,每门都有考试,为了拿到奖学金,小v必须让自己的平均成绩至少为avg。每门课由平时成绩和考试成绩组成,满分为r。现在他知道每门课的平时成绩为ai ,若想让这门课的考试成绩多拿一分的话,小v要花bi 的时间复习,不复习的话当然就是0分。同时我们显然可以发现复习得再多也不会拿到超过满分的分数。为了拿到奖学金,小v至少要花多少时间复习。#include<iostream>usi

2016-03-20 21:10:37 452 1

原创 网易2016研发工程师编程题①

第一题小易经常沉迷于网络游戏.有一次,他在玩一个打怪升级的游戏,他的角色的初始能力值为 a.在接下来的一段时间内,他将会依次遇见n个怪物,每个怪物的防御力为b1,b2,b3…bn. 如果遇到的怪物防御力bi小于等于小易的当前能力值c,那么他就能轻松打败怪物,并 且使得自己的能力值增加bi;如果bi大于c,那他也能打败怪物,但他的能力值只能增加bi 与c的最大公约数.那么问题来了,在一系列的锻炼后,

2016-03-20 21:04:00 430

原创 Android Studio中git的设置

第一步打开Android Studio中的File,找到Setting,找到Git第二步 找到Git的安装目录第三步 先测试一下,如果没问题的话 点击OK 有问题的话 是目录不正确 点击确定找到Git,点击第四步  输入URL就可以克隆了

2016-03-15 17:32:46 692

原创 常见邮箱配置smtp服务器

网易的163和126smtp和pop3服务都是默认开启的网易126免费邮箱相关服务器服务器信息: 邮件服务器名称服务器地址 端口号  POP3服务器pop.126.com 110 SMTP服务器smtp.126.com 25 IMAP服务器im

2016-03-15 14:43:55 2684

空空如也

空空如也

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

TA关注的人

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