- 博客(28)
- 资源 (1)
- 收藏
- 关注
原创 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 integers
2016-09-20 00:14:28 198
原创 LeetCode: Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the
2016-09-19 12:02:51 210
原创 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.题目解析: 到达当前位置(i, j)只有两条路经要么是从左边(i, j- 1)过来,要么从
2016-09-19 11:12:02 173
原创 LeetCode: Find Minimum in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in
2016-09-17 20:19:55 172
转载 Android开发——Android Studio使用新的Gradle构建工具配置NDK环境
本文主要讲述了如何如何在Android Studio使用新的Gradle构建工具配置NDK环境,现在把相关的步骤整理出来分享给Android程序员兄弟们,希望给他们在配置NDK环境时带来帮助。从Android Studio 1.3 Beta1开始,就支持了NDK。不过使用的是一个全新的实验性的gradle构建工具。官方地址 http://tools.android.com/tech-doc
2016-09-17 18:47:05 308
转载 [Android] 环境配置之Android Studio开发NDK
原文链接:http://blog.csdn.net/qiujuer/article/details/42040963说到 NDK 开发,其实是为了有些时候为了项目需求需要调用底层的一些 C/C++ 的一些东西;另外就是为了效率更加高些。但是很多时候能不用就不用;这个是啥原因?个人感觉有些时候是觉得麻烦,首先要配置 NDK 还要 下载 Cygwin ,配置 Cygwin ,然后需
2016-09-17 18:20:03 193
原创 LeetCode: Find Peak Element
A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in
2016-09-16 12:31:43 294
原创 LeetCode: 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 function twoSum should return indices of the two number
2016-09-15 11:42:03 183
原创 LeetCode: Perfect Squares
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n =
2016-09-14 23:48:49 198
原创 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个台阶只可能两种方式达到,从n-1阶走一步
2016-09-14 23:31:37 179
原创 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 is
2016-09-13 23:07:34 174
原创 LeetCode: Subsets
Given a set of distinct integers, nums, return all possible subsets.Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,3], a solution is:[ [3], [1],
2016-09-12 17:17:43 186
原创 LeetCode: Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘
2016-09-12 16:55:50 170
原创 LeetCode: Is Subsequence
Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) strin
2016-09-08 22:57:55 140
原创 LeetCode: Contains Duplicate II
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j]and the difference between i and j is at most k.
2016-09-08 22:06:33 207
原创 LeetCode: Count Primes
Description:Count the number of prime numbers less than a non-negative number, n.Credits:Special thanks to @mithmatt for adding this problem and creating all test cases.Hint:Let's
2016-09-07 23:08:25 222
原创 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 binary tree and sum
2016-09-07 22:48:04 205
原创 LeetCode: 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 space for another array, you must do this in place with
2016-09-06 18:34:25 173
原创 LeetCode: Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you solve it without using extra space?
2016-09-06 17:41:19 203
原创 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?/** * Definition for singly-linked list. * struct ListNode { * int val;
2016-09-06 17:37:13 235
原创 LeetCode: Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y
2016-09-06 12:55:22 185
原创 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.源代码:/** * Definition
2016-09-02 16:55:51 207
原创 LeetCode: First Bad Version
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the
2016-09-02 16:44:47 195
原创 LeetCode: Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5源代码:/** * Definition for
2016-09-02 16:38:56 155
原创 LeetCode: Super Ugly Number
Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime listprimes of size k. For example, [1, 2, 4, 7, 8, 13, 14,
2016-09-02 00:02:27 197
原创 LeetCode: Ugly Number II
Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example,1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10
2016-09-01 23:43:58 171
原创 LeetCode: Ugly Number
Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example,6, 8 are ugly while 14 is not ugly since i
2016-09-01 21:42:22 159
原创 LeetCode: Happy Number
Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares o
2016-09-01 21:34:15 149
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人