- 博客(46)
- 收藏
- 关注
转载 leetcode-Course Schedule
http://www.jyuan92.com/blog/leetcode-course-schedule/ http://www.cnblogs.com/zmyvszk/p/5348786.html 转载于:https://www.cnblogs.com/lilyfindjobs/p/7520080.html
2017-09-14 13:04:00 113
转载 Union-find
讲解:http://www.cnblogs.com/SeaSky0606/p/4752941.html leetcode 相关训练:http://www.cnblogs.com/zmyvszk/p/5351494.html 转载于:https://www.cnblogs.com/lilyfindjobs/p/7509505.html
2017-09-12 12:17:00 96
转载 Convert a given binary tree to double linked list
public TreeNode binaryTree2List(TreeNode node) { if (node == null) return node; // Convert to DLL using bintree2listUtil() node = bintree2listUt...
2017-09-10 07:39:00 105
转载 Find distance between two give node of binary tree
Dis(n1, n2) = Dis(root, n1) + Dis(root, n2) - 2* Dis(root, lca) public static void main(String[] args) { // TODO Auto-generated method stub onsite2 onsite2=new onsite2(); Tree...
2017-09-10 07:04:00 132
转载 leetcode Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: ...
2017-08-20 04:49:00 78
转载 leetcode Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right...
2015-07-23 08:30:00 78
转载 python os turtle
import os def rename_file(): file_name_list=os.listdir(r"/Users/Lily/Documents/ASU1/CodePractise/prank") print(file_name_list) saved_path=os.getcwd() print("current worki...
2015-05-24 02:22:00 127
转载 Hadoop java 程序运行
安装Hadoop:http://khangaonkar.blogspot.com/2012/09/hadoop-2x-tutorial.html yarn-site.xmlAdd the following to etc/hadoop/yarn-site.xml.<?xml version="1.0"?><configuration><proper...
2015-04-25 07:11:00 79
转载 yahoo pipes
yahoo pipes 用来mash up. 可以将各个网站的信息组合起来发布 需要网站的RSS https://pipes.yahoo.com/pipes/docs?doc=sources 注册yahoo即可使用。 转载于:https://www.cnblogs.com/lilyfindjobs/p/4355260.html...
2015-03-21 10:50:00 190
转载 python+postgreSql
def getopenconnection(user='postgres', password='1234', dbname='dds_assgn1'): return psycopg2.connect("dbname='" + dbname + "' user='" + user + "' host='localhost' password='" + passwor...
2015-03-20 06:29:00 166
转载 Static and dynamic binding in java
Static and dynamic binding in java Before Iexplainstatic and dynamic binding in java, lets discuss few terms which will help you to understand the concepts better. What is reference a...
2015-03-12 12:50:00 92
转载 leetcode Sort Listnode
Sort a linked list inO(nlogn) time using constant space complexity. findMiddle: 将listnode 不停的拆分 sort: 将拆分好的不同的sort merge: 将sort好的,向上merge /** * Definition for singly-linked list. * c...
2015-03-08 07:20:00 50
转载 检查密码的复杂性
至少有小写字母,大写字母,数字,特殊字符 static bool IsLetter(char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } static bool IsDigit(char c) { return ...
2015-01-22 13:05:00 174
转载 hackerrank Diameter of Binary Tree
public class DiameterOfTree { public static int diameter = 0; public static int getDiameter(BinaryTreeNode root) { if (root != null) { int ...
2015-01-15 12:31:00 80
转载 hackerrank first repeat word
找出一个string中第一个重复出现的单词; sample: he had had a good son. output: had 句子中可能会出现,comma,colon, semicolon, dash, fullstop/dot 解法:1;dash和dot 都是regular expression中的,出现会有歧义,因此需要加上 转意符\\ 2, hash...
2015-01-15 12:22:00 159
转载 lintcode backpack
Given n items with size A[i], an integer m denotes the size of a backpack. How full you can fill this backpack? 注意 You can not divide any item into small pieces. 样例 If we have 4 item...
2015-01-14 08:21:00 82
转载 leetcode excel Sheet Column Number
Related to questionExcel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ...
2015-01-14 05:00:00 78
转载 leetcode Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 ↘ ...
2015-01-14 00:59:00 52
转载 leetcode 3sum
Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+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-12-27 03:20:00 55
转载 leetcode majority elements
Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times. You may assume that the array is non-empty and the majority element...
2014-12-26 12:42:00 55
转载 leetcode Compare Version Numbers
Compare two version numbersversion1andversion1.Ifversion1>version2return 1, ifversion1<version2return -1, otherwise return 0. You may assume that the version strings are non-emp...
2014-12-26 12:38:00 110
转载 leetcode Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA ...
2014-12-24 07:25:00 75
转载 leetcode Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list. For example,Given1->2->3->3->4->4->5, return...
2014-12-22 14:01:00 79
转载 leetcode Subsets
Given a set of distinct integers,S, return all possible subsets. Note: Elements in a subset must be in non-descending order. The solution set must not contain duplicate subsets. For e...
2014-11-18 05:16:00 61
转载 leetcode Unique Paths/Minimum Path Sum
A robot is located at the top-left corner of amxngrid (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 t...
2014-11-17 10:41:00 84
转载 leetcode Simplify Path
Given an absolute path for a file (Unix-style), simplify it. For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c" 1,java里string的函数split可以用来拆分string。拆分之后放入数组里 2,string...
2014-11-16 04:07:00 81
转载 leetcode Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression inReverse Polish Notation. Valid operators are+,-,*,/. Each operand may be an integer or another expression. Some examples: ["2", "1", "+"...
2014-11-15 08:44:00 51
转载 leetcode Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. For example,Given1->2->3->4, you should return the list as2->1->4->3. Your algorithm should use only ...
2014-11-14 06:55:00 86
转载 leetcode MinStack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top(...
2014-11-11 05:04:00 80
转载 leetcode length of the last word
Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string. If the last word does not exist, return 0. Note:A word is ...
2014-11-06 06:40:00 45
转载 leetcode Remove Nth Node From End of List
Given a linked list, remove thenthnode from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node ...
2014-11-05 07:30:00 42
转载 leetcode Plus One
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. 1,解法。如果最后一位加1大于9,那...
2014-11-04 12:46:00 67
转载 leetcode climbing stairs
You are climbing a stair case. It takesnsteps 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? 1,注意函数 f(n)=f(n-1)+f(n-2) ...
2014-11-03 12:51:00 68
转载 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. 1,注意从新定义listnode后,要将头存一下, 2,头是自己定义的,返回时记得加上.next ...
2014-11-03 08:23:00 85
转载 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]h...
2014-11-02 06:22:00 55
转载 leetcode Binary Tree Level Order Traversal I II
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree{3,9,20,#,#,15,7}, 3 / \ 9 20 ...
2014-11-02 05:56:00 59
转载 leetcode Pascal's Triangle II
Given an indexk, return thekthrow of the Pascal's triangle. For example, givenk= 3,Return[1,3,3,1]. Note:Could you optimize your algorithm to use onlyO(k) extra space? 1,因为题目中要去用o(k),所以...
2014-10-31 08:06:00 52
转载 leetcode pascal's triangle
1, ArrayList 的用法 add,get 2,for 循环中,每执行一遍,注意i的值已经加1 public class Solution { public ArrayList<ArrayList<Integer>> generate(int numRows) { ArrayList<ArrayList<...
2014-10-29 07:20:00 65
转载 leetcode valid parentheses
1, 堆栈的应用,算是很经典的题目 2,记得给stack 设置类型,否则就是object public class Solution { public boolean isValid(String s) { if(s.length()==0||s.length()==1){ return false; ...
2014-10-29 01:52:00 85
转载 leetcode Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example:Given the below binary tree ands...
2014-10-28 06:20:00 42
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人