package com.java.learning.recursion;import java.math.*;public class MainClass { public static void main(String args[]){ for(int i = 0; i < 100; i++){....
分类:
编程语言 时间:
2014-07-07 15:02:14
阅读次数:
290
代码: (使用os.listdir)importosdefListFilesToTxt(dir,file,wildcard,recursion):exts=wildcard.split("")files=os.listdir(dir)fornameinfiles:fullname=os.path.j...
分类:
编程语言 时间:
2014-07-07 14:16:31
阅读次数:
264
递归算法 程序调用自身的编程技巧称为递归( recursion)。 一个过程或函数在其定义或说明中又直接或间接调用自身的一种方法,它通常把一个大型复杂的问题层层转化为一个与原问题类似的规模较小的问题来求解,递归策略仅仅需少量的程序就可描写叙述出解题过程所须要的多次反复计算,大大地降低了程序的...
分类:
其他好文 时间:
2014-07-07 11:52:11
阅读次数:
151
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 ...
分类:
其他好文 时间:
2014-07-02 21:13:05
阅读次数:
170
[LeetCode]Maximum Depth of Binary Tree...
分类:
其他好文 时间:
2014-07-02 08:09:01
阅读次数:
175
【题目】
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
【题意】
给定一堆点,要求找出一条之前上的最大点数
【思路】
没什么好的方法,从每个点P出发,遍历所有的情况
从每个点P出发,斜率相同的点即为统一之前上的点
注意两种特殊情况:
1. 两个点重合(即为同一个点)
...
分类:
其他好文 时间:
2014-07-02 06:52:06
阅读次数:
171
1)打开Window => Preferences窗口2)打开Formatter属性页从Java => CodeStyle => Formatter3) 单击New创建一个自己的Formatter4)选择Line Wrapping属性页,并设置Maximum line width 为1605)然后一...
分类:
系统相关 时间:
2014-07-01 13:52:45
阅读次数:
227
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...
分类:
其他好文 时间:
2014-07-01 00:23:01
阅读次数:
248
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2014-06-30 22:43:45
阅读次数:
294
题目
Given n points
on a 2D plane, find the maximum number of points that lie on the same straight line.
方法
每次选择一个点,和其他n - 1个点,进行判断,统计最多的。
double computeSlope(Point a, Point b) {
...
分类:
其他好文 时间:
2014-06-30 15:48:45
阅读次数:
184