- 博客(50)
- 收藏
- 关注
原创 android O cts 批处理脚本
该文件放在和android-cts平级的目录中@echo offtitle cts testset log=log.txtif exist %log% ( del %log%)set "CTS_ROOT="call:checkPath aaptcall:checkPath adbcall:checkPath javacall:logd check java versionfor /f
2017-12-05 16:27:19
727
原创 LeetCode: 35. Search Insert Position
LeetCode: 35. Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
2017-07-14 13:48:20
390
原创 LeetCode: 217. Contains Duplicate
LeetCode: 217. 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 i
2017-07-12 15:18:02
381
原创 LeetCode: 605. Can Place Flowers
LeetCode: 605. Can Place Flowers Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would com
2017-07-12 14:59:40
472
原创 LeetCode: 27. Remove Element
LeetCode: 27. Remove Element Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this
2017-07-12 14:26:02
436
原创 LeetCode: 26. Remove Duplicates from Sorted Array
LeetCode: 26. 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
2017-07-12 11:20:45
310
原创 LeetCode: 189. Rotate Array
LeetCode: 189. Rotate Array Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Note: Try t
2017-07-12 10:54:02
259
原创 LeetCode: 169. Majority Element
LeetCode: 169. 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
2017-07-11 09:43:37
272
原创 LeetCode: 167. Two Sum II - Input array is sorted
LeetCode: 167. Two Sum II - Input array is sorted Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The
2017-07-11 09:41:34
296
原创 LeetCode: 283. Move Zeroes
LeetCode: 283. 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,
2017-07-11 09:38:09
255
原创 LeetCode: 1. Two Sum
LeetCode: 1. Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution,
2017-07-10 14:14:56
335
原创 LeetCode: 268. Missing Number
LeetCode: 268. Missing Number Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2.
2017-07-10 11:13:45
275
原创 LeetCode: 442. Find All Duplicates in an Array
LeetCode: 442. Find All Duplicates in an Array Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appe
2017-07-10 10:25:21
277
原创 LeetCode: 371. Sum of Two Integers
LeetCode: 371. Sum of Two Integers Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example: Given a = 1 and b = 2, return 3. Credits: Spec
2017-07-07 17:32:16
267
原创 LeetCode: 226. Invert Binary Tree
LeetCode: 226. Invert Binary Tree Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem was inspired by this original
2017-07-07 16:36:18
272
原创 LeetCode: 389. Find the Difference
LeetCode: 389. Find the Difference Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a rand
2017-07-07 16:15:19
310
原创 LeetCode: 448. Find All Numbers Disappeared in an Array
LeetCode: 448. Find All Numbers Disappeared in an Array Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elem
2017-07-07 15:31:56
327
原创 LeetCode: 606. Construct String from Binary Tree
LeetCode: 606. Construct String from Binary Tree You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs t
2017-07-07 15:05:26
372
原创 LeetCode: 520. Detect Capital
LeetCode: 520. Detect Capital Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the fol
2017-07-07 14:00:46
272
原创 LeetCode: 104. Maximum Depth of Binary Tree
LeetCode: 104. 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 farthes
2017-07-07 11:26:56
414
原创 LeetCode: 136. Single Number
LeetCode: 136. 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
2017-07-07 10:57:39
402
原创 LeetCode: 485. Max Consecutive Ones
LeetCode: 485. Max Consecutive Ones Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two digi
2017-07-07 10:22:50
298
原创 LeetCode: 521. Longest Uncommon Subsequence I
LeetCode: 521. Longest Uncommon Subsequence I Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is d
2017-07-07 10:01:15
400
原创 LeetCode: 292. Nim Game
LeetCode: 292. Nim GameYou 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
2017-07-07 09:16:58
283
原创 LeetCode: 463. Island Perimeter
LeetCode: 463. Island Perimeter You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (n
2017-07-06 13:33:44
280
原创 LeetCode: 496. Next Greater Element I
LeetCode: 496. Next Greater Element I You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s ele
2017-07-06 09:49:22
433
原创 LeetCode: 412. Fizz Buzz
LeetCode: 412. Fizz Buzz Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the number and for t
2017-07-05 16:10:00
265
原创 LeetCode: 344. Reverse String
LeetCode: 344. Reverse String Write a function that takes a string as input and returns the string reversed. Example: Given s = “hello”, return “olleh”.public class Solution { public Str
2017-07-05 15:09:17
292
原创 LeetCode: 575. Distribute Candies
LeetCode: 575. Distribute Candies Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresp
2017-07-05 14:35:46
273
原创 LeetCode: 566. Reshape the Matrix
LeetCode: 566. Reshape the Matrix In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original data. You
2017-06-30 17:27:17
298
原创 LeetCode: 500. Keyboard Row
LeetCode: Add to List 500. Keyboard Row Given a List of words, return the words that can be typed using letters of alphabet on only one row’s of American keyboard like the image below. Ame
2017-06-30 16:37:16
300
原创 LeetCode: 557. Reverse Words in a String III
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.
2017-06-30 14:29:02
383
原创 LeetCode: 617. Merge Two Binary Trees
LeetCode: 617. Merge Two Binary Trees Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.
2017-06-29 17:03:35
315
原创 LeetCode: 476. Number Complement
LeetCode: 476. Number Complement Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given integer is guar
2017-06-29 16:53:05
297
原创 LeetCode: 461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note:0 ≤ x,
2017-05-12 00:12:32
351
原创 LeetCode: 561. Array Partition I
561. Array Partition IGiven an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi)
2017-05-10 23:39:45
441
原创 mac tree工具安装 总结
tree工具的安装主要参照下面的链接OS X equivalent of the Ubuntu “tree” command方法有两种:一、直接源码编译首先从tree中下载源码,修改Makefile,将下列注释打开# Uncomment for OS X:
2017-05-02 11:58:05
572
原创 mac 终端 shell 下载 android系统源码 方法总结
第一次用Mac下载Android源码,遇到过一些问题。下面总结下,记录遇到过得问题一、配置mac相关环境,具体方法Google有给出Setting up a Mac OS build environment1、shell中输入如下命令,创建一个大小写敏感,40g大小的盘,名字后缀可能是.dmg或者.dmg.sparseimage,其中~/android.dmg可以更换位置。我的是生
2017-04-28 00:14:46
673
原创 mac 中 caps lock和control键交换,以及alt键替换option方法
第一次使用mac,发现键盘都不会使用一、习惯使用emacs编辑器,control键和caps lock键必须交换位置1.首先进入“系统偏好设置”2.点击“键盘”3.点击“修饰键”,可以选择大小锁定键为“Contorl”,选择Control键为“大小锁定键”,这样就能方便使用Control键了二、alt键替换option方法在终端界面中,点击左上方
2017-04-27 00:56:28
21980
原创 批处理 push apk或者jar 3
@echo offset "dirpath=%CD%"echo dirpath=%dirpath%for /f "tokens=1,2 delims==" %%i in ('type .\\init') do ( set "%%i=%%j")echo jar=%jar%echo jarpath=%jarpath%echo reboot=%reboot%echo inp
2016-08-05 14:09:56
385
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅