- 博客(230)
- 资源 (20)
- 收藏
- 关注
原创 LeetCode——N-Queens II
Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.原题链接:https://oj.leetcode.com/problems/n-queens-ii/题目:求有多少个独立的解决方案
2014-10-29 11:16:04
2093
原创 LeetCode--N-Queens
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.
2014-10-28 19:28:29
2222
原创 在Hadoop监控页面如何查看Hive的完整SQL
如图,这里只能看到简单的一段SQL,几乎看不出具体在执行什么任务。此时可以点开一个application,点击Tracking URL:ApplicationMaster进入到MapReduce Job job_1409xxxx,Job页面点击左侧的Configuration这里有此Job对应的所有参数,在 右上角的搜索框中输入string,其中key为 hive.
2014-10-13 11:31:03
7169
原创 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 3Return 6.
2014-09-15 12:21:00
1937
原创 LeetCode——Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.原题链接:https://oj.leetcode.com/problems/construct-bi
2014-09-14 11:26:29
2052
原创 LeetCode——Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.原题链接:https://oj.leetcode.com/problems/construct-binary-
2014-09-14 11:07:49
2184
原创 LeetCode——Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]
2014-09-13 20:24:06
2121
原创 LeetCode——Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown below. 1 3
2014-09-09 12:26:46
2009
原创 LeetCode——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?原题链接:https://oj.leetcode.com/problems/rotate-image/
2014-09-06 11:44:08
1977
原创 LeetCode——Divide Two Integers
Divide two integers without using multiplication, division and mod operator.原题链接:https://oj.leetcode.com/problems/divide-two-integers/题目:两数相除,不使用乘法、除法和模运算。思路:只能使用减法了,还有位运算可以当成乘除法来用。开始做的时候用
2014-09-03 12:40:11
2288
原创 LeetCode——Permutations II
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1], and [2,1,1].
2014-09-01 13:05:13
1933
原创 LeetCode——Next Permutation
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible
2014-08-30 19:59:04
1737
原创 LeetCode——Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.原题链接:https://oj.leetcode.com/problems/merge-k-sorted-lists/题目:归并 k 个有序链表,返回一个有序链表。思路:之前有做过归并
2014-08-30 18:53:52
1829
原创 LeetCode——Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is
2014-08-30 11:10:16
1960
原创 Python操作MySQL乱码问题解决
使用Python的MySQLdb模块连接并操作MySQL的时候,对于中文,查询时候查不出来,插入数据时候是乱码。很头疼。最后的解决办法如下:conn = MySQLdb.connect(...)cur = conn.cursor()cur.execute("SET NAMES utf8;") cur.execute("SET CHARACTER SET utf8;") cur.exec
2014-08-26 13:21:49
2069
原创 Hadoop MapReduce纵表转横表 与 横表转纵表
输入数据如下:以\t分隔0-3岁育儿百科 书 230-5v液位传感器 50-5轴承 20-6个月奶粉 230-6个月奶粉c2c报告 230-6个月奶粉在线购物排名 230-6个月奶粉市场前景 230-6个月配方奶粉 230.001g电子天平 50.01t化铝炉 20.01吨熔铝合金炉 20.03吨化镁炉
2014-08-24 10:37:51
3292
原创 LeetCode——4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Element
2014-08-23 16:37:10
1786
原创 LeetCode——3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exact
2014-08-23 16:16:47
1921
原创 LeetCode——3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c
2014-08-23 15:00:41
2040
1
原创 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.原题链接:题目:给定一个m * n 的矩阵,如果有一个元素是0,将其所在行和列设为0.思路:先记录下是0 的元素的位置,再去置0. public void setZeroes(int[][] m
2014-08-23 12:04:12
1989
原创 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 first integer of each
2014-08-23 11:47:04
1918
原创 hadoop中文分词、词频统计及排序
有如图所示的输入文件。其中第一列代表ip地址,之后的偶数列代表搜索词,数字(奇数列)代表搜索次数,使用"\t"分隔。现在需要对搜索词进行分词并统计词频,此处不考虑搜索次数,可能是翻页,亦不考虑搜索链接的行为。
2014-08-17 11:24:50
15597
2
原创 CNZZ网站流量统计原理简析
这是我的网站www.iyizhan.com,其中只有一个页面index.html,在index.html上放置了如下的 js 脚本:src="http://s11.cnzz.com/stat.php?id=5364825&web_id=5364825" language="JavaScript">1.当用户访问这个页面时,会请求src,对应的是上面的脚本的源文件:
2014-08-17 09:09:51
11780
原创 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
2014-08-16 11:48:19
1939
原创 LeetCode——Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of
2014-08-16 11:36:54
2222
原创 LeetCode——Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.原题链接:https://oj.leetcode.com/problems/merge-two-sorted-
2014-08-16 11:09:46
1916
原创 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 (size that is greater or equal to m + n) to hold additional elements fro
2014-08-16 10:50:09
1735
原创 LeetCode——Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recursive solutio
2014-08-16 10:18:00
1804
原创 LeetCode——Permutations
Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].原题链接:https://oj
2014-08-10 09:57:53
1747
原创 LeetCode——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.原题链接:https://oj.leetcode.com/problems/convert-sorted-list-to-binary-search-tree/题目:给定一个
2014-08-10 09:06:48
2010
原创 LeetCode——Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.原题链接:https://oj.leetcode.com/problems/convert-sorted-array-to-binary-search-tree/题目:给定一个升序排列元素的数组,将
2014-08-09 16:24:45
1736
原创 LeetCode——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?原题链接:https://oj.leetcode.com/problems/rotate-image/
2014-08-09 16:12:53
1779
原创 LeetCode——Insertion Sort List
Sort a linked list using insertion sort.原题链接:https://oj.leetcode.com/problems/insertion-sort-list/题目:用插入排序对一个链表排序。 public ListNode insertionSortList(ListNode head) { ListNode newHead = new L
2014-08-09 13:37:53
1740
原创 LeetCode——Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be non
2014-08-09 12:05:17
2181
原创 LeetCode——Search in Rotated Sorted Array II
Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the
2014-08-09 10:49:20
1642
原创 Hive Python Streaming的原理及写法
在Hive中,需要实现Hive中的函数无法实现的功能时,就可以用Streaming来实现。其原理可以理解成:用HQL语句之外的语言,如Python、Shell来实现这些功能,同时配合HQL语句,以实现特殊的功能。比如,我有一张不同网站访问的日志表,其中有两个列是url和ref,分别代表当前访问的网址和来源地址,我想要查看用户的来源,即看用户都是从那些网站跳到这些网站上去的,这里有些网站可能域名
2014-08-07 19:49:29
4698
原创 LeetCode——Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,2,1] ha
2014-08-05 21:23:18
1733
原创 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 only use constant
2014-08-04 21:35:34
1870
转载 Spark,一种快速数据分析替代方案
虽然 Hadoop 在分布式数据分析方面备受关注,但是仍有一些替代产品提供了优于典型 Hadoop 平台的令人关注的优势。Spark 是一种可扩展的数据分析平台,它整合了内存计算的基元,因此,相对于 Hadoop 的集群存储方法,它在性能方面更具优势。Spark 是在 Scala 语言中实现的,并且利用了该语言,为数据处理提供了独一无二的环境。了解 Spark 的集群计算方法以及它与 Hado
2014-08-03 16:13:02
2041
原创 LeetCode——Populating Next Right Pointers in Each Node
题目: 给定一个二叉树(假设是完全二叉树),把每个节点的next指针指向其右侧节点。 思路:首先想到的是,层序遍历树,在遍历的同时添加节点对右侧节点的指针。另一种简洁的方法是采用递归来实现,间单直观。
2014-08-03 12:57:27
1902
实时分析-分析和可视化流数据的技术
2015-02-09
水木清华社区招聘信息定时抓取,部署于新浪云
2014-06-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅