- 博客(10)
- 资源 (2)
- 收藏
- 关注
原创 python时间戳于时间格式字符串相互转换的方法
python时间戳于时间格式字符串相互转换的方法1.当前时间:import timetimestamp = int(time.time()) #获取当前时间戳timestruct = time.localtime(timestamp) #获取当前时间的时间数组,tm_year,tm_mon,tm_wday.....str_time = time.strftime("%Y%
2015-06-10 14:31:33 493
转载 MapReduce中map任务个数的确定
在map阶段读取数据前,FileInputFormat会将输入文件分割成split。split的个数决定了 map的个数。 影响map个数,即split个数的因素主要有: 1)HDFS块的大小,即HDFS中dfs.block.size的值。如果有一个输入文件为1024m,当块为 256m时,会被划分为4个split;当块为128m时,会被划分为8个split。 2)文件的大小。当块为128
2015-03-25 09:48:13 2989 1
原创 LeetCode----将代码放到github上了
准备以后直接将代码放到github上,项目地址:https://github.com/tangzhiyi11/LeetCode-eclipse
2014-12-07 19:19:04 3679
原创 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?刚开始没看见下面不用额外空间的话,用set搞了个:public static boolean hasCycle(ListNode head){ListNod
2014-12-06 19:02:02 298
转载 五大常用算法之二:动态规划算法
五大常用算法之二:动态规划算法一、基本概念 动态规划过程是:每次决策依赖于当前状态,又随即引起状态的转移。一个决策序列就是在变化的状态中产生出来的,所以,这种多阶段最优化决策解决问题的过程就称为动态规划。二、基本思想与策略 基本思想与分治法类似,也是将待求解的问题分解为若干个子问题(阶段),按顺序求解子阶段,前一子问题的解,为后一子问题的求解提供了有用的信息。在
2014-12-06 16:50:06 195
原创 LeetCode-----Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1
2014-12-06 15:48:40 253
原创 LeetCode------Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy
2014-12-06 15:06:34 237
原创 Leetcode----Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.非递
2014-12-06 11:08:39 224
原创 LeetCode----Maximum Depth of Binary Tree
这题比较简单,简单的递归下就完事了,难怪排AC第二高的,感觉比AC第一高的容易多了public int maxDepth(TreeNode root){if(root==null)return 0;int result=FindDepth(root,1);return result;}public static int FindDepth(TreeNode ro
2014-12-05 21:37:48 306
原创 LeetCode----SingerNumer,奋斗的开始~
准备开始刷LeetCOde,为下学期的找工作做准备(基础太不扎实了。。举步维艰)第一道,AC率最高的一道:Single Number Total Accepted: 46425 Total Submissions: 101039 My Submissions Question Solution Given an array of integers, every element appe
2014-12-05 20:36:29 243
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人