自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 华为笔试

package huawei;import java.util.ArrayList;import java.util.Scanner;/** * 和尚挑水 */public class FindWater { private static final String inCase = "1 0 0 1 0 1 0\n" + "0 0 1 1 0 0 0

2016-10-10 17:01:48 395

原创 归并排序

Version 1 /** * 归并排序 */ private static int[] mergeSort(int[] src, int start, int end) { if (start == end) { return new int[]{src[start]}; } int m

2016-09-25 19:54:05 345

原创 字符串排序

/** * 字符串排序 * 输入:fed1l9u5u12 * 输出:11259defluu */public class StringSort { public static void main(String[] args) { String input = "fed1l9u5u12"; System.out.println(sort(input)

2016-09-25 19:12:12 307

原创 围圈报数

import java.util.ArrayList;import java.util.Scanner;public class Baoshu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int len = scanner.n

2016-09-21 22:42:38 487

原创 大数相加

/** * Created by syh on 2016/9/20. * 大数相加 */public class BigNumber { public static void main(String[] args) { String num1 = "1045"; String num2 = "55"; System.out.print

2016-09-20 23:50:47 284

原创 百度笔试

baidu 格子距离import java.util.Scanner;public class Main { public static String input = "2\n" + "3 3 1 1\n" + "8 0 0\n" + "2 0 0\n" + "1 4 0\n" +

2016-09-20 20:12:43 238

原创 Java中的矩阵使用

public class TestArr { public static void main(String[] args) { int m = 3; // m行 int n = 4; // n列 int[][] arr = new int[m][n]; // m行n列矩阵 = m个长度为n的数组 = 3个长度为4的数组 Sys

2016-09-20 19:39:02 1323

原创 快速排序

参考public class QuickSort { public static int[][] midCases = { {1, 2, 3}, {2, 1, 3}, {3, 1, 2}, {2, 3, 1}, {1, 2}, {2, 1}}

2016-09-17 21:49:09 238

原创 [2017腾讯校招在线笔试题]

import java.util.ArrayList;import java.util.Scanner;public class Main { public static ArrayList rst = new ArrayList(); public static void main(String[] args) { Scanner in = new Sc

2016-09-11 20:52:26 5012 3

原创 ArrayList的contains方法与Object的equals方法的关系

ArrayList的contains方法判断两个元素是否为同一元素的标准是该元素(姑且当做Object)的equals方法。下面的例子可以说明问题。public static void main(String[] args) { String str1 = new String("sangyaohui"); String str2 = new String("sangyaohu

2016-04-11 11:17:37 1000

原创 [剑指offer][第四章][28]字符串的排列

[牛客网]字符串测排列题目理解:题目个给的字符串中可能包含重复的字符,你给出的解中也要包含这些重复的字符,但是解集中不应该包含重复的解。import java.util.ArrayList;public class Solution { public ArrayList Permutation(String str) { // 2016-04-11

2016-04-11 11:03:41 228

原创 [剑指offer][第四章][25]Binary Tree Path Sum

[LintCode]Binary Tree Path Sum/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.v

2016-04-11 09:57:48 252

原创 [2016.4][京东暑期实习笔试]三子棋

package bupt.syh;import java.io.File;import java.io.FileNotFoundException;import java.util.Scanner;public class Main { /** * @param args */ public static void main(String[] args) { Scan

2016-04-08 21:26:11 1028 1

原创 [2016.4][京东暑期实习笔试]生日礼物

package bupt.syh;import java.util.ArrayList;import java.util.List;import java.util.Scanner;public class Main { private static Envelope card; public static void main(String[] args) { Scanner

2016-04-08 21:22:23 580

原创 [剑指offer][第三章][12] Print Numbers by Recursion

[LintCode]Print Numbers by RecursionVersion 1public class Solution { /** * @param n: An integer. * return : An array storing 1 to the largest number with n digits. */ public

2016-04-08 15:04:23 331

原创 [剑指offer][第三章][18]Subtree

[LintCode]Subtree/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val = val; *

2016-04-08 14:17:23 248

原创 [剑指offer][第三章][14]Partition Array by Odd and Even

[LintCode]Partition Array by Odd and Evenpublic class Solution { /** * @param nums: an array of integers * @return: nothing */ public void partitionArray(int[] nums) {

2016-04-08 10:33:58 310

原创 [2016.4][微软笔试]Font Size

题目1 : Font Sizeimport java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int caseNum = in.nextInt(); int

2016-04-07 16:57:00 254

原创 [刷题]Maximum Subarray II

[LintCode]Maximum Subarray IIpublic class Solution { /** * @param nums: A list of integers * @return: An integer denotes the sum of max two non-overlapping subarrays */ public

2016-04-06 09:52:16 371

原创 [hiho]后序遍历

[hiho]后序遍历import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { String pre = in.nextLine();

2016-04-05 16:01:20 276

原创 [2016腾讯暑期实习在线笔试题][蛇形矩阵]

package bupt.syh;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { String inputStr = in.nex

2016-04-03 21:58:08 549 1

原创 java中Int与String的相互转化方法

1 String -> int 有两个方法:1). int i = Integer.parseInt(str);2). int i = Integer.valueOf(str).intValue();注: 字串转成 Double, Float, Long 的方法大同小异.2 int -> String 有三种方法:1.) String s = S

2016-04-03 21:21:56 252

原创 [2016腾讯暑期实习在线笔试题]最长回文字符串

import java.util.Scanner;public class Main { // 动态规划 public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { String input = in.nextLine(); i

2016-04-03 21:08:20 1541 1

转载 HTTP状态码大全

完整的 HTTP 1.1规范说明书来自于RFC 2616,你可以在http://www.talentdigger.cn/home/link.php?url=d3d3LnJmYy1lZGl0b3Iub3JnLw%3D%3D在线查阅。HTTP 1.1的状态码被标记为新特性,因为许多浏览器只支持 HTTP 1.0。你应只把状态码发送给支持 HTTP 1.1的客户端,支持协议版本可以通过调用reque

2016-04-02 21:03:32 239

原创 [刷题]Implement Stack

[LintCode]Implement Stackclass Stack { ArrayList list = new ArrayList(); public void push(int x) { list.add(x); } public void pop() { list.remove(list.size() - 1);

2016-03-15 09:28:37 221

原创 [刷题]Ugly Number

[LintCode]Ugly NumberVersion 1 失败class Solution { /** * @param k: The number k. * @return: The kth prime number as description. */ public long kthPrimeNumber(int k) {

2016-03-10 15:13:47 214

原创 [刷题]Top K Frequent Words

[LintCode]Top K Frequent Wordspublic class Solution { /** * @param words an array of string * @param k an integer * @return an array of string */ public String[] topKFreq

2016-03-09 11:03:36 844

原创 [刷题] Merge k Sorted Arrays

[LintCode]Merge k Sorted Arraypublic class Solution { /** * @param arrays k sorted integer arrays * @return a sorted array */ public List mergekSortedArrays(int[][] arrays) {

2016-03-08 22:00:39 329

原创 [刷题]Binary Tree Maximum Path Sum II

[LintCode]Binary Tree Maximum Path Sum II/** * Definition of TreeNode: * public class TreeNode { *     public int val; *     public TreeNode left, right; *     public TreeNode(int val) {

2016-03-08 10:02:16 285

原创 SwipeListViewExampleActivity工程使用说明

一、文件介绍本界面共有两个工程,分别为main和SwipeListViewExampleActivity。其中main工程为基础工程,主要提供给android程序一个可以左右滑动的列表,其内部并没有具体的数据和按键。SwipeListViewExampleActivity工程为具体实现,它引入了main工程,并在此基础上添加了数据与所需的按钮。二、具体使用使用时需引入两个工程,之后在m

2015-12-21 15:50:33 313

原创 ubuntu下的android开发环境搭建

在linux下搭建android的开发环境要点(1)下载最新JDK(注意为linux版),甲骨文网站。设置环境变量。(2)从developer.android.com网站上下载eclipse(含ADT)+SDK(3)设置SDK的环境变量,设置eclipse的sdk路径,用SDKmanager下载最新的SDKpackage(4)用AVD创建android模拟器,建议targe

2015-12-17 16:17:56 388

原创 Win7环境下安装ubuntu双系统的方法

本文内容主要来自网络教程,经笔者重新整理。安装ubuntu可以从硬盘安装,u盘安装,光盘安装。这里介绍的是硬盘安装方法。本文测试的是64位ubuntu-14.04.1-desktop-amd64.iso,该方法笔者亲测有效。【第一步】准备分区,在win7计算机上右键--管理--磁盘管理1)装Ubuntu分配的硬盘大小最好是(20G以上)不要太小。这里

2015-12-14 17:06:37 455

原创 iOS恢复固件的方法

恢复固件会清空iOS设备上所有的资料,就相当于将电脑的硬盘全部格式化后装一个全新的Windows,可以有效解决因长期使用导致设备系统变慢的问题。注意:越狱用户恢复固件后,系统将回到未越狱状态。这里以ipad4为例详述恢复固件的步骤。下载最新ios固件iPad3,4_8.1.3_12B466_Restore.ipsw下载并安装最新版itunes将ipad连接至电脑

2015-12-14 16:52:20 1046

转载 Linux文件描述符与C FILE之间的关系

1. linux文件描述符    对于linux而言,所有对设备和文件的操作都使用文件描述符来进行的。文件描述符是一个非负的整数,它是一个索引值,指向内核中每个进程打开文件的记录表。当打开一个现存文件或创建一个新文件时,内核就向进程返回一个文件描述符;当需要读写文件时,也需要把文件描述符作为参数传递给相应的函数。    通常,一个进程启动时,都会打开3个文件:标准输入、标准输出和标准出错处

2015-11-28 15:24:40 714

转载 回车的传说

如果你有在windows下编程的经验就会发现windows下敲下回车键会产生两个字符CR和LF,用16进制编辑器打开windows下的文本文件也会看到换行是0D和0A表示的,也就是CR和LF的ASCII编码。而在UNIX类系统中换行只有一个字符LF,所以UNIX中的文本文件在windows中用记事本打开会出现不可解析字符且丢失换行格式,所有字符连成一行。    因为windows下的记事本读到

2015-11-28 11:16:11 306

原创 [刷题]3 Sum

[LintCode]3 Sumpublic class Solution { /** * @param numbers : Give an array numbers of n integer * @return : Find all unique triplets in the array which gives the sum of zero. */

2015-10-14 09:46:30 271

原创 [刷题]Inorder Successor in BST

[LintCode]Inorder Successor in BSTpublic class Solution { /** * @param A: An integer array * @param target: An integer * @return : An integer which is the index of the target numb

2015-10-13 10:23:38 292

原创 [刷题]Search in a Big Sorted Array

[LintCode]Search in a Big Sorted Arraypublic class Solution { /** * @param A: An integer array * @param target: An integer * @return : An integer which is the index of the target

2015-10-13 09:43:19 497

原创 Windows下载Android源码

如果想在Windows下载Android源码,我们就必须先在Windows环境下搭建一个模拟的linux环境,这个模拟的环境有那么几个,可以到网上搜一下,这里我们用Cygwin来搭建,这个相对简单。这里之所以选择Windows是因为Windows翻墙相对容易,使用uuu加速器即可。另外,如果英文好的话可以直接参考安卓源码官网1. 安装Cygwin下载 Cygwin

2015-10-12 21:54:43 331

转载 Android关于Theme.AppCompat相关问题的深入分析

先来看这样一个错误:No resource found that matches the given name '@style/Theme.AppCompat.Light'对于这个错误,相信大部分Android开发者都遇到过,可能很多朋友通过百度或者Google已经解决了这个问题,但是网上大部分都只给出了解决方法。正所谓知其然,知其所以然,本文将从此问题出发,深入分析探讨导

2015-10-01 14:48:32 246

空空如也

空空如也

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

TA关注的人

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