- 博客(36)
- 资源 (5)
- 收藏
- 关注
原创 Leetcode-triangle
题目描述Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2],
2016-07-29 10:33:31 212
原创 Leetcode-binary-tree-maximum-path-sum
题目描述Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3
2016-07-24 18:00:53 377
原创 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 ret
2016-07-24 16:53:51 161
原创 Leetcode-path-sum
题目描述Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below bina
2016-07-24 15:28:05 165
原创 本地代码同步至github
这个问题我遇到一次都要重新摸索一下,今天好好总结一下。假设SSH KEY这些步骤已经完成了(没完成的网上一堆),现在就是怎么把本地的代码上传到github上。既然SSH KEY这些步骤完成了,你现在一定有一个github的账户了,接下来的步骤是这样的。登录到github上以后,点击右上角+按钮:点击之后,进入如下界面,填写相关信息:点击create之后,就成功地
2016-07-22 19:25:05 350
转载 Android的序列化和反序列化
之前参加某外企公司的面试,面试官让我写一个序列化和反序列化的代码,写的不对,痛心疾首,回来好好学习!本文转自:http://www.cnblogs.com/xdp-gacl/p/3777987.html一、序列化和反序列化的概念 把对象转换为字节序列的过程称为对象的序列化。 把字节序列恢复为对象的过程称为对象的反序列化。 对象的序列化主要有两种用途
2016-07-21 13:48:57 925
原创 Leetcode-longest-consecutive-sequence
题目描述Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest consecutive elements seque
2016-07-20 17:34:03 361
原创 Leetcode-two-sum
题目描述Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to
2016-07-20 16:23:54 196
原创 Leetcode-single-number-ii
题目描述Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implem
2016-07-20 13:32:06 216
原创 Leetcode-word-break
题目描述Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens ="leetcode",
2016-07-19 14:27:56 230
原创 Leetcode-linked-list-cycle-ii
题目描述Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?在判断链表中是否有环题目的基础上扩展了,返回环开始的节
2016-07-19 12:32:13 186
原创 Leetcode-length-of-last-word
题目描述Given a string s consists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word
2016-07-19 10:21:27 281
原创 Leetcode-candy
题目描述There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements: Each child
2016-07-19 10:08:45 170
原创 Leetcode-insertion-sort-list ***
题目描述Sort a linked list using insertion sort.题目越短,事情越大。用插入排序法对链表进行排序。我是参考别人的解答做的,这题我不会。 * public class ListNode { * int val; * ListNode nex
2016-07-17 17:18:38 220
原创 排序-插入排序、选择排序
插入、选择、快速排序我学了几年,一直忘了学,学了忘,这次和女朋友一起学,我发现我一下子记住了呢! public static void insertSort(int[] data){ if(data==null && data.length < 2) return; for(int i=1; i<data.length; i++){ int cu
2016-07-17 16:39:22 168
原创 Leetcode-binary-tree-postorder-traversal
题目描述Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].Note: R
2016-07-17 16:21:56 210
原创 Leetcode-sum-root-to-leaf-numbers
题目描述Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which represents the number123.Find
2016-07-17 16:04:58 475
原创 Leetcode-sort-list
题目描述Sort a linked list in O(n log n) time using constant space complexity.链表排序,要求时间负责度为0(n log n),可以看出来我们需要利用归并排序比较好。下面结合代码解释解题思路: * class ListNode { * i
2016-07-17 15:33:27 150
原创 排序-归并排序
今天研究了一下归并排序,原理是这样的:将两个(或两个以上)有序表合并成一个新的有序表,即把待排序序列分为若干个子序列,每个子序列是有序的。然后再把有序子序列合并为整体有序序列综合并运用递归和归并的方法:代码是这样的:/** * 归并排序 */package algorithm;public class Test { public static void main(
2016-07-17 15:02:40 214
原创 Leetcode-evaluate-reverse-polish-notation
题目描述Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples:
2016-07-16 20:16:01 233
原创 Leetcode-max-points-on-a-line
题目描述Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.题目越短,事情越大!一个二维坐标系中有n个点,求出在同一条直线上的点的个数的最大值。注意:在同一条线上,不规定
2016-07-09 22:34:13 422
原创 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 valu
2016-07-09 20:44:40 200
原创 Leetcode-minimum-depth-of-binary-tree
题目描述Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.题目意思是比较明确的,求一个树的最短路径。需要考虑的
2016-07-09 20:30:10 174
原创 Leetcode-minimum-path-sum
题目描述Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either
2016-07-07 21:08:46 262
原创 Leetcode-pascals-triangle-ii
题目描述Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space
2016-07-04 17:08:34 551
原创 Leetcode-sort-colors
题目描述Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the
2016-07-04 16:33:57 201
原创 Leetcode-gas-station
题目描述There are N gas stations along a circular route, where the amount of gas at station i isgas[i].You have a car with an unlimited gas tank and it costscost[i]of gas to travel from st
2016-07-04 16:13:44 417
原创 Leetcode-merge-sorted-array
题目描述Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional elements from B. The number of elemen
2016-07-04 15:19:10 180
原创 Leetcode-symmetric-tree
题目描述Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3
2016-07-04 14:35:35 205
原创 Leetcode-search-a-2d-matrix
题目描述Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The fir
2016-07-04 14:10:49 240
转载 Android操作HTTP实现与服务器通信
整理一下android和服务器通信的知识,转载过来一篇经典博文:http://www.cnblogs.com/hanyonglu/archive/2012/02/19/2357842.html 在此感谢原作者,你的文章让我的博客蓬!荜!生!辉!本示例以Servlet为例,演示Android与Servlet的通信。众所周知,Android与服务器通信通常采用HTTP通信方式
2016-07-04 10:28:24 206
原创 Leetcode-single-number
题目描述Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it
2016-07-01 17:20:52 199
原创 Leetcode-populating-next-right-pointers-in-each-node-ii ***
题目描述Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may on
2016-07-01 16:51:29 350
原创 Leetcode-subsets-ii ***
题目描述Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not
2016-07-01 16:11:44 263
原创 Leetcode-set-matrix-zeroes
题目描述Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution
2016-07-01 13:30:37 327
原创 Leetcode-populating-next-right-pointers-in-each-node
题目描述Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its
2016-07-01 11:52:42 235
Android 暗黑模式,dark mode,demo源码
2020-04-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人