自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

转载 大数据多路归并排序

多路归并排序问题给你1个文件bigdata,大小4663M,5亿个数,文件中的数据随机,如下一行一个整数:61963023557681612158020393452095006174677379343122016371712330287901712966901...7005375现在要对这个文件进行排序,怎么搞?内部排序先

2016-06-10 19:52:28 758

原创 347. Top K Frequent Element(java)

Given a non-empty array of integers, return the k most frequent elements.For example,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always valid, 1 ≤ k ≤ number

2016-06-10 14:32:43 725

转载 java system.out.printf()的使用方法

package test;public class Main{ public static void main(String[] args) { // 定义一些变量,用来格式化输出。 double d = 345.678; String s = "你好!"; int i = 1234; // "%"表示进行格式化输出,"%"之后的内容为格式的定义。 System

2016-06-10 12:54:39 5353

原创 109. Convert Sorted List to Binary Search Tree

题目:    Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.解析:把有序的链表convert成AVL树想到使用递归,例如【1,2,3,4,5,6,7】中间的数4作为树的root,左子树为123,右子树为567。利

2016-06-03 16:03:25 305

原创 求0至大数之间的随机数

题目:给定一个String类型的大数,不能直接转化为Integer,类似如下要求The numbers can be arbitrarily large and are non-negative.Converting the input string to integer is NOT allowed.You should NOT use internal libr

2016-06-02 10:36:59 639

原创 2. Add Two Numbers(Java)

题目: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 return it as a l

2016-05-29 20:54:10 326

原创 142. Linked List Cycle I&II

Linked List Cycle I 只是单纯地确定是否有cycle,可以使用两个指针(fast和slow),fast每次走两步,slow每次走一步。若最后有相交的节点,则有环;若fast节点为null,则无环。也可以使用其他方法,题目并没有要求不能破坏原链表。   相较于I,题目II要求不能修改原链表。题目:Given a linked list, return the node wh

2016-05-29 17:25:27 711

原创 66. Plus One(Java) & 43. Multiply Strings

题目:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.大意:一个非负正数用数组A表示,例

2016-05-29 16:23:44 473

原创 154. Find Minimum in Rotated Sorted Array II

题目: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.The array may contain duplicates.此题

2016-05-27 15:32:54 202

原创 59. Spiral Matrix II

题目:Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7

2016-05-27 13:12:48 214

原创 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

2016-05-27 13:06:24 219

原创 75. 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 intege

2016-05-27 13:03:21 247

原创 48. Rotate Image

You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise). Follow up:     Could you do this in-place?1.首先找旋转后的第一条规律,设n=4     [0][0]->[0][3]    

2016-05-27 13:00:57 234

原创 11. Container With Most Water

Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two li

2016-05-27 12:58:54 241

原创 349. Intersection of Two Arrays I &&II (Java)

Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element in the result must be unique. The result

2016-05-27 12:56:58 3368

原创 289. Game of Life

According to the Wikipedia’s article: “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.”Given a board with m by

2016-05-27 12:54:35 325

空空如也

空空如也

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

TA关注的人

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