- 博客(76)
- 收藏
- 关注
原创 堆排序
import java.util.HashMap;public class heapSort { public static void sort(int[] a) { // 循环建立初始堆,若父节点索引为i,那么左节点的索引为i*2+1,即左节点为a.length时,其父节点应当小于a.length/2 for (int i = a.length /
2017-09-04 14:10:43
240
原创 Gson将JsonObject转JavaBean整条崩溃状况解决
昨天被提了一个需求,最近后台传来的json数据,部分类型和javabean所需要的类型有出入,导致app整个崩溃,希望对网络模块能对转换过程进行控制虽然这是一个后台的锅,但是被甩给网络模块并甩给了我。表示无奈。。。我只是来实习的啊为了解决这个问题,需要更深入的了解Gson,所以先用retrofit写了一个demoretrofit = new Retrofit.Builder()
2017-08-22 08:22:58
1063
1
原创 retrofit2原理学习(未完待续)
最简单的okhttp+retrofit2使用demoretrofit= new Retrofit.Builder() .baseUrl("https://api.douban.com/v2/") .build();service= retrofit.create(RetrofitService.class);Call call = se
2017-08-07 17:03:43
382
原创 648. Replace Words
In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For example, the root an, followed by other, whic
2017-07-31 09:12:41
256
原创 Retrofit+Rxjava乞丐封装
为了进一步了解Retrofit,Rxjava。之前的简单学习了Retrofit,Rxjava简单使用请教了一下坐在 右边的国华前辈他介绍了rxjava,retrofit封装这篇博文给我,我就依葫芦画瓢的对今天写的代码进行一个简单封装(其实中间还是有很多不懂,不过我还是先把东西跑起来)之所以叫乞丐封装。。因为是这篇博文的低配版本,因为主要目的是为了加强自己的理解很多东西都省略了首先定
2017-07-28 18:12:24
401
原创 Retrofit+Rxjava简单使用
嗯,为了未来的工作。。好像说可能需要对网络请求的部分进行重构Retrofit的简单使用上一篇主要看了retrofit的简单使用下面看一下配合Rxjava使用的网络请求改动有retrofit = new Retrofit.Builder() .baseUrl("https://api.douban.com/v2/") .addConverter
2017-07-28 14:49:27
390
原创 Retrofit2简单使用
今天的任务是熟悉一下Retrofit。。网上找了点资料领完写了个Demo找了个URL:https://api.douban.com/v2/book/search?q=%E9%87%91%E7%93%B6%E6%A2%85&tag=&start=0&count=1用到了compile 'com.squareup.retrofit2:retrofit:2.1.0'compile 'c
2017-07-28 10:24:52
291
转载 android获得准确sha1
1) 将apk修改后缀为 .rar文件后解压; 2) 进入解压后的META-INF目录,该目录下会存在文件CERT.RSA 3) 在该目录下打开cmd,输入命令 :keytool -printcert -file CERT.RSA 这里将会显示出MD5和SHA1签名。
2017-07-21 09:45:01
233
原创 593. Valid Square
我其实挺佩服我自己的。。。这题考的是初中平面几何。。而我居然还记得23333public class Solution { public boolean validSquare(int[] p1, int[] p2, int[] p3, int[] p4) { int[] nums = new int[6]; nums[0] = (p1[0] - p2[0]
2017-06-23 18:52:40
268
原创 592. Fraction Addition and Subtraction
题目不难,但是感觉很考写代码的功底Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final result should be irreducibl
2017-06-23 17:23:05
329
原创 2017_06_22几题leetcode
624. Maximum Distance in ArraysGiven m arrays, and each array is sorted in ascending order. Now you can pick up two integers from two different arrays (each array picks
2017-06-22 21:39:41
279
原创 暂存
public int findLHS(int[] nums) { HashMap map=new HashMap<>(); if(nums.length==0){ return 0; } int low=0; int max=1; for(int i=1;ilength;i++){ int temp=0;
2017-06-21 17:22:51
228
原创 提交到远程库
我们强烈建议所有的git仓库都有一个README, LICENSE, .gitignore文件Git入门?查看 帮助 , Visual Studio / TortoiseGit / Eclipse / Xcode 下如何连接本站, 如何导入项目简易的命令行入门教程:Git 全局设置:git config --global user.name "..."git conf
2017-05-15 16:54:05
277
原创 爱奇异17/5/14初赛题目
今天的赛事题目,一共四题。。做出来三题,最后一题来不及了,感觉工作量比较大水平太次弄不出来,但是难度还是比较一般第一题,顺时针打印矩阵,没什么好说的/** * Created by zyl on 2017/4/27. */import java.util.*;public class Main { public static void main(String[] args){
2017-05-14 22:08:31
330
原创 滑动窗口最大值
群里看到的,原型是leetcode 239题目239. Sliding Window MaximumGiven an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see
2017-05-02 20:46:31
361
原创 把一个整数数组,分成个大小相同的子数组
今天有个人问我题目,大概就是要把一个整数数组,分成个大小相同的子数组做不到的话就返回nullimport java.util.*;public class divide { public static void main(String[] args) { int[] array = {2 ,3, 4 ,1 ,6 }; ArrayList list=
2017-04-28 15:18:43
878
转载 android--存储之SharePreference
原博客地址http://blog.csdn.net/jie1991liu/article/details/8665479感谢:怎么连话都说不清楚SharePreference提供一些基础的信息存储功能,所有的信息都是按照“key = value”的形式进行保存,但是Android.content.Sharepreference借口所保存的信息只能是一些基本数据类型,如字符串,整形
2017-04-25 19:49:58
298
转载 图解 Android 事件分发机制
原博地址:http://www.jianshu.com/p/e99b5e8bd67b感谢博主:Kelin在Android开发中,事件分发机制是一块Android比较重要的知识体系,了解并熟悉整套的分发机制有助于更好的分析各种点击滑动失效问题,更好去扩展控件的事件功能和开发自定义控件,同时事件分发机制也是Android面试必问考点之一,如果你能把下面的一些事件分发图当场画出来肯定加分不少
2017-04-24 16:20:09
297
转载 深入理解JVM之JVM内存区域与内存分配
原博文地址:http://www.cnblogs.com/hellocsl/p/3969768.html?utm_source=tuicool&utm_medium=referral感谢博主:helloocsl深入理解JVM之JVM内存区域与内存分配 前言:这是一篇关于JVM内存区域的文章,由网上一些有关这方面的文章和《深入理解Java虚拟机》整理而来,所以会有些类同
2017-04-24 10:18:55
241
转载 【安卓学习之工具学习】adb初步学习--adb命令和shell命令学习
原文连接http://blog.csdn.net/ljb568838953/article/details/52212427感谢 博主:拜天地一 、 测试环境讲解: 1.一台win7电脑 2.安装好sdk,在 sdk\platform-tools 目录下,可以看到adb.exe 文件 3.为了方便输入,可以设置环境变量,将adb.exe的路径放到Path中。在变量
2017-04-24 10:16:51
662
原创 leetcode 127. Word Ladder
127. Word Ladder这是一道广度优先遍历的题目Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
2017-04-19 20:14:51
417
原创 leetcode 468. Validate IP Address
神烦的一题Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither.IPv4 addresses are canonically represented in dot-decimal notation, which consists o
2017-04-19 16:43:56
262
原创 leetcode 220. Contains Duplicate III
Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] andnums[j] is at most t and the absolute diff
2017-04-18 23:03:48
288
原创 leetcode 553. Optimal Division
Given a list of positive integers, the adjacent integers will perform the float division. For example, [2,3,4] -> 2 / 3 / 4.However, you can add any number of parenthesis at any position to change
2017-04-17 10:10:17
828
原创 leetcode 151. Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C programmers: Try to solve it in-place in
2017-04-16 14:36:01
337
原创 leetcode 98. Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.Th
2017-04-16 14:18:24
194
转载 (懒人必备)Android开源数据库LitePal
博客原地址:http://www.jianshu.com/p/557682e0a9f0感谢:博主:Shaun白一辰 的整理感谢:郭霖大虾的开源项目litepal。。。特此转载,以备使用Activity开源数据库LitePal开源地址:https://github.com/LitePalFramework/LitePal虽然不想承认,但是我的SQLite知
2017-04-15 22:00:44
359
原创 leetcode 304. Range Sum Query 2D - Immutable
Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2,col2).The above rectangle (with the red bor
2017-04-15 21:55:07
181
原创 leetcode 306. Additive Number
这算一个比较复杂的dfs题目了中间很多坑,比如这个加法,为了避开overflow ,找了一个string add,还有str前面不能有零,算法思想是没什么难度的,主要在于编程实现能力把。。个人感觉就这样了Additive number is a string whose digits can form additive sequence.A valid additive s
2017-04-15 19:42:17
209
原创 今日头条面试
3月30号的面试今天下午。。参加今日头条面试一面:问了一些基础吧,语言问的java,包括java gc啊,java的集合,然后多态然后各种,android问了下基础的,service activity什么的生命周期啦,android的布局啦,怎么自定义view啦,又问了计算机网络http协议,包括cookies,http头部里面有什么。。然后写了个代码结束,五分钟后通知过了,马上二面
2017-04-10 19:05:26
739
原创 leetcode 557. Reverse Words in a String III
Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take LeetCode contes
2017-04-10 11:27:54
622
原创 重建二叉树
输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。 public TreeNode reConstructBinaryTree(int [] pre,int [] in) { if(pre.l
2017-04-07 15:01:39
334
原创 leetcode 3. 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 "
2017-04-07 10:20:55
491
原创 leetcode 402. Remove K Digits
Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.Note:The length of num is less than 10002 and will b
2017-04-06 17:18:15
220
原创 leetcode 93. Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]. (Order
2017-04-06 14:28:19
267
原创 leetcode 18. 4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The solution
2017-04-06 12:41:41
195
原创 leetcode 61. Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.Subscribe to see which companies
2017-04-06 11:03:57
209
原创 leetcode 208. Implement Trie (Prefix Tree)
Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.Subscribe to see which companies asked this questi
2017-04-06 10:38:44
277
原创 矩形分割
时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi有一块由NxM个单位正方形组成的矩形。现在小Ho在某些单位正方形上画了一道分割线,这条分割线或者是单位正方形的主对角线(用'\'表示),或者是副对角线(用'/'表示)。 现在小Hi想知道这些分割线把NxM的矩形分割成了多少块区域。例如/\\/就把2x2的矩形分成
2017-04-05 16:40:07
648
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人