自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(77)
  • 资源 (5)
  • 收藏
  • 关注

原创 剑指offer 二维数组中的查找

在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。javapublic class Solution { public boolean Find(int target, int [][] array) { if (array == null || array.le

2017-10-31 20:29:22 361

原创 Find Minimum in Rotated Sorted Array II

Suppose an array sorted in ascending order 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.The array may contain du

2017-10-31 20:18:08 158

原创 367. Valid Perfect Square

Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.Example 1:Input: 16Return

2017-10-31 19:35:15 194

原创 240. Search a 2D Matrix II

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 in ascending from left to right.Integers in

2017-10-31 14:46:42 166

原创 34. Search for a Range

Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the targ

2017-10-31 14:17:57 183

原创 Total Occurrence of Target

Given a target number and an integer array sorted in ascending order. Find the total number of occurrences of target in the array.Have you met this question in a real interview? Yes

2017-10-30 20:45:25 324

原创 368. Largest Divisible Subset

Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0.If there are multiple solution

2017-10-29 21:51:58 345

原创 354. Russian Doll Envelopes

You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the width and height of one envelope is greater than

2017-10-29 21:05:26 255

原创 300. Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101], ther

2017-10-29 20:14:03 346

原创 674. Longest Continuous Increasing Subsequence

Given an unsorted array of integers, find the length of longest continuous increasing subsequence.Example 1:Input: [1,3,5,4,7]Output: 3Explanation: The longest continuous increasing subseq

2017-10-29 19:59:06 276

原创 Jump Game II

Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to

2017-10-29 19:32:53 263

原创 70. 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?Note: Given n will be a positive

2017-10-29 18:53:00 265

原创 63. Unique Paths II

动态规划的问题,属于坐标型动态规划(二维)Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0

2017-10-29 16:46:14 179

原创 62. 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 bo

2017-10-29 16:34:55 170

原创 64. 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 down or right at

2017-10-29 16:19:59 300

原创 120. 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], [3,4], [

2017-10-29 11:11:47 191

原创 692. Top K Frequent Words

Given a non-empty list of words, return the k most frequent elements.Your answer should be sorted by frequency from highest to lowest. If two words have the same frequency, then the word with the lo

2017-10-28 16:10:03 740

转载 TreeMap使用简介

原文出自:http://cmsblogs.com/?p=1013。尊重作者的成果,转载请注明出处!          个人站点:http://cmsblogs.com-------------------------------------------------------------------------------------------------------------

2017-10-27 14:39:55 770

原创 658. Find K Closest Elements

Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If there is a tie, the smaller elements are always p

2017-10-27 14:37:01 281

原创 K Closest Points

Given some points and a point origin in two dimensional space, find k points out of the some points which are nearest to origin.Return these points sorted by distance, if they are same with dist

2017-10-27 14:13:50 508

原创 Merge k Sorted Arrays

Given k sorted integer arrays, merge them into one sorted array.Have you met this question in a real interview? YesExampleGiven 3 sorted arrays:[ [1, 3, 5, 7], [2, 4, 6],

2017-10-26 21:24:07 399

原创 Data Stream Median

Numbers keep coming, return the median of numbers at every time a new number added.Have you met this question in a real interview? YesClarificationWhat's the definition of Medi

2017-10-26 20:57:52 166

原创 Top k Largest Numbers II

Given an integer array, find the top k largest numbers in it.Have you met this question in a real interview? YesExampleGiven [3,10,1000,-99,4,100] and k = 3.Return [1000, 100

2017-10-26 20:00:48 176

原创 378. Kth Smallest Element in a Sorted Matrix

javaclass Solution { public int kthSmallest(int[][] matrix, int k) { if (matrix == null || matrix.length == 0 || matrix[0].length == 0) { return -1; } Queue q

2017-10-26 14:33:51 190

原创 Top k Largest Numbers II

Implement a data structure, provide two interfaces:add(number). Add a new number in the data structure.topk(). Return the top k largest numbers in this data structure. k is given when we creat

2017-10-25 22:56:32 362

原创 264. 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, 12is the sequence of the first 1

2017-10-25 22:43:46 141

原创 263. 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 si

2017-10-25 21:19:14 161

原创 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 sequence is [1, 2, 3

2017-10-25 20:40:48 200

原创 242. Valid Anagram

Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You may ass

2017-10-25 19:54:20 194

原创 49. Group Anagrams

Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note: All in

2017-10-25 19:42:30 259

原创 Anagrams

Given an array of strings, return all groups of strings that are anagrams. NoticeAll inputs will be in lower-caseHave you met this question in a real interview? YesEx

2017-10-25 19:40:41 304

原创 Continuous Subarray Sum

Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of k, that is, sums up t

2017-10-25 14:06:49 180

原创 146. LRU Cache

必会题目!!! Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.get(key) - Get the value (will always be positive) of the key

2017-10-24 21:16:05 174

原创 Rehashing

The size of the hash table is not determinate at the very beginning. If the total size of keys is too large (e.g. size >= capacity / 10), we should double the size of the hash table and rehash every ke

2017-10-24 15:24:28 589

原创 132 Pattern

Given a sequence of n integers a1, a2, ..., an, a 132pattern is a subsequence ai, aj, ak such that i j kand ai ak aj. Design an algorithm that takes a list of n numbers as input and checks whether

2017-10-23 21:59:19 285

原创 Zigzag Iterator ii

Follow up Zigzag Iterator: What if you are given k 1d vectors? How well can your code be extended to such cases? The "Zigzag" order is not clearly defined and is ambiguous for k > 2 cases. If "Z

2017-10-23 21:04:36 316

原创 Zigzag Iterator

Given two 1d vectors, implement an iterator to return their elements alternately.Have you met this question in a real interview? YesExampleGiven two 1d vectors:v1 = [1, 2]v2

2017-10-23 19:42:46 133

原创 341. Flatten Nested List Iterator

Given a nested list of integers, implement an iterator to flatten it.Each element is either an integer, or a list -- whose elements may also be integers or other lists.Example 1:Given the li

2017-10-23 16:17:24 260

原创 Expression Expand

java思路不复杂,只是代码的量有点大,而且涉及到了一些类型转换。public class Solution { /* * @param s: an expression includes numbers, letters and brackets * @return: a string */ public String expressionE

2017-10-22 15:24:02 182

原创 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 the multiples of five output “Buzz”.

2017-10-21 15:48:08 179

机器学习(吴恩达)week2编程作业

机器学习(吴恩达)week2编程作业

2017-07-23

研究生“计算机通信新技术”课程复习题(2016年)

研究生“计算机通信新技术”课程复习题(2016年)

2017-01-11

基于Hessian滤波器的血管增强算法

基于Hessian滤波器的血管增强算法

2017-01-02

颜色相关图

颜色相关图

2015-11-07

空空如也

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

TA关注的人

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