command line - Why hard links are not allowed for directories? - Ask Ubuntu Symlinks can: Point to ...

Please Visit: http://ift.tt/1ajReyV



command line - Why hard links are not allowed for directories? - Ask Ubuntu



Symlinks can:

Point to directories

Point to non-existent objects

Point to files and directories outside the same filesystem

Hard links can:

Keep the file that they reference from being deleted

Hard links are especially useful in performing "copy on write" applications. They allow you to keep a backup copy of a directory structure, while only using space for the files that change between two versions.

The command cp -al is especially useful in this regard. It makes a complete copy of a directory structure, where all the files are represented by hard links to the original files. You can then proceed to update files in the structure, and only the files that you update will take up additional space. This is especially useful when maintaining multigenerational backups.

http://ift.tt/UWg7R2

http://ift.tt/UWg5su



command line - Why hard links are not allowed for directories? - Ask Ubuntu







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mt9BXA

via LifeLong Community

Why isn’t it possible to create hard links across file system boundaries? - nixCraft A single inode...

Please Visit: http://ift.tt/1ajReyV



Why isn’t it possible to create hard links across file system boundaries? - nixCraft



A single inode number use to represent file in each file system. All hard links based upon inode number.

So linking across file system will lead into confusing references for UNIX or Linux.

http://ift.tt/1q2Jhtl

http://ift.tt/TtgDER



Why isn’t it possible to create hard links across file system boundaries? - nixCraft







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1q2JhJB

via LifeLong Community

Why is it possible to create symbolic links across file system boundaries? Symbolic links link by pathname...

Please Visit: http://ift.tt/1ajReyV



Why is it possible to create symbolic links across file system boundaries?

Symbolic links link by pathname rather than inode number. As you know, each pathname is a unique file on a system. Because of this, it is possible to create symbolic links across file system boundaries.

http://ift.tt/TtgAZE

http://ift.tt/1q2Jf4u



Why is it possible to create symbolic links across file system boundaries?







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/TtgAZG

via LifeLong Community

Understanding UNIX / Linux symbolic (soft) and hard links - nixCraft Hard links cannot link directories.Cannot...

Please Visit: http://ift.tt/1ajReyV



Understanding UNIX / Linux symbolic (soft) and hard links - nixCraft

Hard links cannot link directories.Cannot cross file system boundaries.

Soft or symbolic links are just like hard links. It allows to associate multiple filenames with a single file. However, symbolic links allows:To create links between directories.Can cross file system boundaries.

These links behave differently when the source of the link is moved or removed.Symbolic links are not updated.Hard links always refer to the source, even if moved or removed.

http://ift.tt/Mmt0zp

http://ift.tt/1q2JeO8



Understanding UNIX / Linux symbolic (soft) and hard links - nixCraft







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/TtgAZC

via LifeLong Community

Understanding UNIX / Linux filesystem Inodes - nixCraft the inode identifies the file and its attributes...

Please Visit: http://ift.tt/1ajReyV



Understanding UNIX / Linux filesystem Inodes - nixCraft

the inode identifies the file and its attributes (as above) . Each inode is identified by a unique inode number within the file system. Inode is also know as index number.

http://ift.tt/1kBJCCX

http://ift.tt/1msrB4o



Understanding UNIX / Linux filesystem Inodes - nixCraft







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/UVGQgs

via LifeLong Community

10 xargs command example in Linux - Unix tutorial http://ift.tt/1m8aScm...

Please Visit: http://ift.tt/1ajReyV



10 xargs command example in Linux - Unix tutorial

http://ift.tt/1wVgKb6



10 xargs command example in Linux - Unix tutorial







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1wVgKbf

via LifeLong Community

xargs: How To Control and Use Command Line Arguments utility. xargs reads items from the standard input...

Please Visit: http://ift.tt/1ajReyV



xargs: How To Control and Use Command Line Arguments

utility. xargs reads items from the standard input or pipes, delimited by blanks or newlines, and executes the command one or more times with any initial-arguments followed by items read from standard input. Blank lines on the standard input are ignored.

http://ift.tt/RN1d6n

http://ift.tt/1qTfwNh



xargs: How To Control and Use Command Line Arguments







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1qTfuVr

via LifeLong Community

10 Example of find command in Unix and Linux http://ift.tt/1moWZ3N...

Please Visit: http://ift.tt/1ajReyV



10 Example of find command in Unix and Linux

http://ift.tt/1qTfwNb



10 Example of find command in Unix and Linux







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1moWZRk

via LifeLong Community

LeetCode - Longest Palindromic Substring | Darren's Blog Given a string S, find the longest palindromic...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Longest Palindromic Substring | Darren's Blog

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.

http://ift.tt/1mF8ecY

http://ift.tt/1wT9vjZ



LeetCode - Longest Palindromic Substring | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1wT9v3C

via LifeLong Community

Rafal's Blog - LeetCode 26 – Remove Element The idea is to look for elem from the left, and swap into...

Please Visit: http://ift.tt/1ajReyV



Rafal's Blog - LeetCode 26 – Remove Element

The idea is to look for elem from the left, and swap into its place something from the right of the array, so that all elems are at the end of the array

http://ift.tt/1wRLaLy

http://ift.tt/1qjYBDm



Rafal's Blog - LeetCode 26 – Remove Element







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1qjYyYj

via LifeLong Community

LeetCode - Merge k Sorted Lists | Darren's Blog Merge k sorted linked lists and return it as one sorted...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Merge k Sorted Lists | Darren's Blog

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.

http://ift.tt/1qjYB6z

http://ift.tt/1wRLbPn



LeetCode - Merge k Sorted Lists | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1qjYyHT

via LifeLong Community

LeetCode - Longest Valid Parentheses | Darren's Blog Given a string containing just the characters '...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Longest Valid Parentheses | Darren's Blog

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the longest valid parentheses substring is "()", which has length = 2. Another example is ")()())", where the longest valid parentheses substring is "()()", which has length = 4.

http://ift.tt/1wRL9Hj

http://ift.tt/1wRL8mH



LeetCode - Longest Valid Parentheses | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1qjYyro

via LifeLong Community

LeetCode – Valid Parentheses (Java) public static boolean isValid(String s) { char[] charArray = s.toCharArray...

Please Visit: http://ift.tt/1ajReyV



LeetCode – Valid Parentheses (Java)

public static boolean isValid(String s) {

char[] charArray = s.toCharArray();



HashMap<Character, Character> map = new HashMap<Character, Character>();

map.put('(', ')');

map.put('[', ']');

map.put('{', '}');



Stack<Character> stack = new Stack<Character>();



for (Character c : charArray) {

if (map.keySet().contains(c)) {

stack.push(c);

} else if (map.values().contains(c)) {

if (!stack.isEmpty() && map.get(stack.peek()) == c) {

stack.pop();

} else {

return false;

}

}

}

return stack.isEmpty();

}

http://ift.tt/1qjYAQ2

http://ift.tt/1qjYB6g



LeetCode – Valid Parentheses (Java)







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1wRL7iI

via LifeLong Community

西小瓜: Leetcode: Search for a Range Given a sorted array of integers, find the starting and ending position...

Please Visit: http://ift.tt/1ajReyV



西小瓜: Leetcode: Search for a Range

Given a sorted array of integers, find the starting and ending position of a given target value.

Your algorithm's runtime complexity must be in the order of O(log n).

If the target is not found in the array, return [-1, -1].

For example,

Given [5, 7, 7, 8, 8, 10] and target value 8,

return [3, 4].

http://ift.tt/1jsv3fs

http://ift.tt/1qQhDBe



西小瓜: Leetcode: Search for a Range







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1jsv3vK

via LifeLong Community

LeetCode - Valid Sudoku | Darren's Blog Determine if a Sudoku is valid, according to: Sudoku Puzzles...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Valid Sudoku | Darren's Blog



Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules (Link->http://ift.tt/1qQhAp1) . The Sudoku board could be partially filled, where empty cells are filled with the character '.'. Below is a partially filled sudoku which is valid.

http://ift.tt/1jsv5E7

http://ift.tt/1jsv2YW



LeetCode - Valid Sudoku | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1qQhD4i

via LifeLong Community

LeetCode - Multiply Strings | Darren's Blog Given two numbers represented as strings, return multiplication...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Multiply Strings | Darren's Blog

Given two numbers represented as strings, return multiplication of the numbers as a string. Note that the numbers can be arbitrarily large and are non-negative.

http://ift.tt/1jsv2YI

http://ift.tt/1qQhCNF



LeetCode - Multiply Strings | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1jsv2YK

via LifeLong Community

LeetCode - Trapping Rain Water | Darren's Blog Given n non-negative integers representing an elevation...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Trapping Rain Water | Darren's Blog

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], return 6.

http://ift.tt/1jsv576

http://ift.tt/1qQhwFS



LeetCode - Trapping Rain Water | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1jsv5no

via LifeLong Community

LeetCode - First Missing Positive | Darren's Blog Given an unsorted integer array, find the first missing...

Please Visit: http://ift.tt/1ajReyV



LeetCode - First Missing Positive | Darren's Blog



Given an unsorted integer array, find the first missing positive integer. For example, given [1,2,0] return 3, and [3,4,-1,1] return 2. Your algorithm should run in O(n) time and uses constant space.

http://ift.tt/1lkSln0

http://ift.tt/VtLG5d



LeetCode - First Missing Positive | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lkSln4

via LifeLong Community

LeetCode - Combination Sum | Darren's Blog Given a set of candidate numbers C and a target number T...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Combination Sum | Darren's Blog



Given a set of candidate numbers C and a target number T, find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C unlimited number of times.

Note:

All numbers (including target) will be positive integers.

Elements in a combination (a1,a2,…,ak)(a_1, a_2, \ldots, a_k) must be in non-descending order. (i.e., a1≤a2≤⋯≤aka_1\leq a_2\leq \cdots \leq a_k ).

The solution set must not contain duplicate combinations.

For example, given candidate set 2,3,6,7 and target 7, a solution set is: { [7], [2, 2, 3] }

http://ift.tt/VtLEdC

http://ift.tt/VtLFOR



LeetCode - Combination Sum | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lkSirr

via LifeLong Community

LeetCode - N-Queens | Darren's Blog The n-queens puzzle is the problem of placing n queens on an n×n...

Please Visit: http://ift.tt/1ajReyV



LeetCode - N-Queens | Darren's Blog

The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.

http://ift.tt/1nO9MOn

http://ift.tt/1lTFLj5



LeetCode - N-Queens | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lTFLj7

via LifeLong Community

喵喵~: Maximum subarray@leetcode Find the contiguous subarray within an array (containing at least one...

Please Visit: http://ift.tt/1ajReyV



喵喵~: Maximum subarray@leetcode

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] has the largest sum = 6.

http://ift.tt/1lTFJrx

http://ift.tt/1nO9PKb



喵喵~: Maximum subarray@leetcode







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lTFJrz

via LifeLong Community

My Own Notes: Leetcode: Anagrams Given an array of strings, return all groups of strings that are anagrams...

Please Visit: http://ift.tt/1ajReyV



My Own Notes: Leetcode: Anagrams

Given an array of strings, return all groups of strings that are anagrams.

Note: All inputs will be in lower-case.

http://ift.tt/1lTFL2F

http://ift.tt/1nO9MxU



My Own Notes: Leetcode: Anagrams







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lTFL2H

via LifeLong Community

LeetCode – Pow(x, n) Implement pow(x, n). http://ift.tt/1lTFL2B http:...

Please Visit: http://ift.tt/1ajReyV



LeetCode – Pow(x, n)

Implement pow(x, n).

http://ift.tt/1lTFL2B

http://ift.tt/1nO9MhA



LeetCode – Pow(x, n)







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lTFL2D

via LifeLong Community

Jump Game Given an array of non-negative integers, you are initially positioned at the first index of...

Please Visit: http://ift.tt/1ajReyV



Jump Game

Given an array of non-negative integers, you are initially positioned at the first index of the array.

Each element in the array represents your maximum jump length at that position.

Determine if you are able to reach the last index.

http://ift.tt/1lTFJaY

http://ift.tt/1lTFJb0



Jump Game







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lTFI6X

via LifeLong Community

Jump Game II Given an array of non-negative integers, you are initially positioned at the first index...

Please Visit: http://ift.tt/1ajReyV



Jump Game II



Given an array of non-negative integers, you are initially positioned at the first index of the array.

Each element in the array represents your maximum jump length at that position.

Your goal is to reach the last index in the minimum number of jumps.

For example:

Given array A = [2,3,1,1,4]

The minimum number of jumps to reach the last index is 2. (Jump 1 step from index 0 to 1, then 3 steps to the last index.)

http://ift.tt/1mjfcjb

http://ift.tt/1pUqYGt



Jump Game II







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mjfab5

via LifeLong Community

LeetCode - Insert Interval | Darren's Blog Given a set of non-overlapping intervals, insert a new interval...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Insert Interval | Darren's Blog



Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times.

Example 1:

Given intervals [1,3],[6,9], insert and merge [2,5] in as [1,5],[6,9].

Example 2:

Given [1,2],[3,5],[6,7],[8,10],[12,16], insert and merge [4,9] in as [1,2],[3,10],[12,16]. This is because the new interval [4,9] overlaps with [3,5],[6,7],[8,10].

http://ift.tt/1pUqWhR

http://ift.tt/1mjfc2F



LeetCode - Insert Interval | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pUqWhU

via LifeLong Community

Dutch National Flag Problem http://ift.tt/1pUqT5R

Please Visit: http://ift.tt/1ajReyV



Dutch National Flag Problem

http://ift.tt/1pUqT5R



Dutch National Flag Problem







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pUqW1h

via LifeLong Community

LeetCode – Merge Intervals Given a collection of intervals, merge all overlapping intervals. For example...

Please Visit: http://ift.tt/1ajReyV



LeetCode – Merge Intervals

Given a collection of intervals, merge all overlapping intervals.

For example,

Given [1,3],[2,6],[8,10],[15,18],

return [1,6],[8,10],[15,18].

http://ift.tt/1mAtjW9

http://ift.tt/1qzwcXK



LeetCode – Merge Intervals







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mAtlgM

via LifeLong Community

Ashes To Glory: Rotating a 2D array of integers (matrix) by a given angle (+90, -90, +180, -180) Problem...

Please Visit: http://ift.tt/1ajReyV



Ashes To Glory: Rotating a 2D array of integers (matrix) by a given angle (+90, -90, +180, -180)

Problem definition: You are given a 2D square matrix, or 2D array of integers of size n (n rows and n columns), your output should be n by n 2D matrix rotated by a given angle, which could be +90, -90, +180, -180.

http://ift.tt/1qzwe1B

http://ift.tt/1mAtjpc



Ashes To Glory: Rotating a 2D array of integers (matrix) by a given angle (+90, -90, +180, -180)







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1qzwcXu

via LifeLong Community

LeetCode - Spiral Matrix II | Darren's Blog Given an integer nn , generate a square matrix filled with...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Spiral Matrix II | Darren's Blog

Given an integer nn , generate a square matrix filled with elements from 1 to n2n^2 in spiral order

http://ift.tt/1qzhn7o

http://ift.tt/1mzBVMz



LeetCode - Spiral Matrix II | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1qzhn7s

via LifeLong Community

LeetCode – Spiral Matrix (Java) Given a matrix of m x n elements (m rows, n columns), return all elements...

Please Visit: http://ift.tt/1ajReyV



LeetCode – Spiral Matrix (Java)



Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.

For example, given the following matrix:

[

[ 1, 2, 3 ],

[ 4, 5, 6 ],

[ 7, 8, 9 ]

]

You should return [1,2,3,6,9,8,7,4,5].

http://ift.tt/1mzBSQS

http://ift.tt/1qzhmQS



LeetCode – Spiral Matrix (Java)







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mzBSQW

via LifeLong Community

algorithms - Lower bound for finding second largest element - Mathematics Stack Exchange First find ...

Please Visit: http://ift.tt/1ajReyV



algorithms - Lower bound for finding second largest element - Mathematics Stack Exchange

First find the maximum using a "tennis tournament" structure: first compare the nn elements in pairs, then compare the n/2n/2 "winners" in pairs, and so on. (Unpaired elements get a bye to the next round.) Since every element except the winner loses exactly once, this takes n−1n-1 comparisons. But now note that the second largest element must be one which lost to the winner, as it couldn't have been defeated by any other element. So you need to find the maximum among all the (up to) ⌈lgn⌉\lceil \lg n \rceil elements that were defeated by the winner, and finding this maximum can be done in ⌈lgn⌉−1\lceil \lg n \rceil - 1.

http://ift.tt/1qzhmAw

http://ift.tt/1qzhmQM



algorithms - Lower bound for finding second largest element - Mathematics Stack Exchange







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1qzhksf

via LifeLong Community

Output of the recursive program - PuzzlersWorld.com void print (int n){ if (n>0) { printf(“hello”...

Please Visit: http://ift.tt/1ajReyV



Output of the recursive program - PuzzlersWorld.com

void print (int n){ if (n&gt;0) { printf(“hello”); print(n-1); } printf(“world”);}

http://ift.tt/1qzhm3r

http://ift.tt/1qzhm3t



Output of the recursive program - PuzzlersWorld.com







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mzBOkl

via LifeLong Community

Average speed of train - PuzzlersWorld.com A train is going at a speed of 60kmph towards Delhi and ...

Please Visit: http://ift.tt/1ajReyV



Average speed of train - PuzzlersWorld.com



A train is going at a speed of 60kmph towards Delhi and returned back at a speed of 30kmph. What is its average speed?

.pw-middle-responsive{width:320px;height:100px}@media(min-width: 500px){.pw-middle-responsive{width:468px;height:60px}}@media(min-width: 800px){.pw-middle-responsive{width:728px;height:90px}}

http://ift.tt/1qzhjEL

http://ift.tt/1qzhlMY



Average speed of train - PuzzlersWorld.com







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mzBNNl

via LifeLong Community

Rotate an array right by k element without using any other array Given an array of n elements, write...

Please Visit: http://ift.tt/1ajReyV



Rotate an array right by k element without using any other array

Given an array of n elements, write an algorithm to rotate it right by k element without using any other array. In other words rotate an array in place.

http://ift.tt/1mzBNwz

http://ift.tt/1mzBNwB



Rotate an array right by k element without using any other array







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mzBNwH

via LifeLong Community

一天一学: Leetcode - Minimum Path Sum Given a m x n grid filled with non-negative numbers, find a path from...

Please Visit: http://ift.tt/1ajReyV



一天一学: Leetcode - 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 any point in time.

http://ift.tt/1mzBKkp

http://ift.tt/1mzBMsL



一天一学: Leetcode - Minimum Path Sum







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mzBKkv

via LifeLong Community

LeetCode - Unique Paths II | Darren's Blog Follow up for LeetCode - Unique Paths (Link->http://www.d...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Unique Paths II | Darren's Blog

Follow up for LeetCode - Unique Paths (Link->http://ift.tt/1mzBLF0) . Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space is marked as 1 and 0 respectively in the grid.

http://ift.tt/1qzhfVC

http://ift.tt/1qzhfVE



LeetCode - Unique Paths II | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mzBLVr

via LifeLong Community

Combinations - Rosetta Code import java.util.Collections; import java.util.LinkedList; public class...

Please Visit: http://ift.tt/1ajReyV



Combinations - Rosetta Code

import java.util.Collections;

import java.util.LinkedList;



public class Comb{



public static void main( (Link->http://ift.tt/1qzhfEY) [] args){

(Link->http://ift.tt/1qzhi3E) .out.println(comb(3,5));

}



public static (Link->http://ift.tt/1qzhfEY) bitprint(int u){

(Link->http://ift.tt/1qzhfEY) s= "";

for(int n= 0;u > 0;++n, u>>= 1)

if((u & 1) > 0) s+= n + " ";

return s;

}



public static int bitcount(int u){

int n;

for(n= 0;u > 0;++n, u&= (u - 1));//Turn the last set bit to a 0

return n;

}



public static (Link->http://ift.tt/1qzhfEY) > comb(int c, int n){

(Link->http://ift.tt/1qzhfEY) >();

for(int u= 0;u < 1 << n;u++)

if(bitcount(u) == c) s.push(bitprint(u));

(Link->http://ift.tt/1qzhi3G) .sort(s);

return s;

}

}

http://ift.tt/1qzhi3J

http://ift.tt/1mzBJgg



Combinations - Rosetta Code







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mzBJgk

via LifeLong Community

Alexander Kruel · Number of combinations with repetition there are 10 symbols ‘C’ and 3 partition walls...

Please Visit: http://ift.tt/1ajReyV



Alexander Kruel · Number of combinations with repetition



there are 10 symbols ‘C’ and 3 partition walls, represented by a ‘+’ sign. That is, there are n-1+k = 13, equivalently n+k-1, symbols. Further note that each of the 3 partition walls could be in 1 of 13 positions. In other words, to represent various choices of 10 candies from 4 categories, the positions of the partition walls could be rearranged by choosing n-1 = 3 of n+k-1 = 13 positions

http://ift.tt/1lsodeo

http://ift.tt/1pEDk3z



Alexander Kruel · Number of combinations with repetition







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lsocqP

via LifeLong Community

Unique Paths | LeetCode A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in...

Please Visit: http://ift.tt/1ajReyV



Unique Paths | LeetCode

A robot is located at the top-left corner of a m x n grid (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 the bottom-right corner of the grid (marked ‘Finish’ in the diagram below). How many possible unique paths are there?

http://ift.tt/1v9UGH1

http://ift.tt/1v9UGH5



Unique Paths | LeetCode







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mxDo6g

via LifeLong Community

LeetCode - Add Binary | Darren's Blog Given two binary strings, return their sum (also a binary string...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Add Binary | Darren's Blog

Given two binary strings, return their sum (also a binary string). For example, given a = "11" and b = "1", return "100".

http://ift.tt/1o5yVHl

http://ift.tt/1lXrBiv



LeetCode - Add Binary | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1o5yVHt

via LifeLong Community

Finding the Minimum Window in S which Contains All Elements from T | LeetCode Given a set T of characters...

Please Visit: http://ift.tt/1ajReyV



Finding the Minimum Window in S which Contains All Elements from T | LeetCode



Given a set T of characters and a string S, find the minimum window in S which will contain all the characters in T in complexity O(n).

eg,

S = “ADOBECODEBANC”

T = “ABC”

Minimum window is “BANC”.

http://ift.tt/1lXrB1P

http://ift.tt/1o5yTiR



Finding the Minimum Window in S which Contains All Elements from T | LeetCode







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lXrB1R

via LifeLong Community

Java: ArrayDeque http://ift.tt/1lWkSoZ

Please Visit: http://ift.tt/1ajReyV



Java: ArrayDeque

http://ift.tt/1lWkSoZ



Java: ArrayDeque







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lWkSp6

via LifeLong Community

LeetCode - Simplify Path | Darren's Blog Given an absolute path for a file (Unix-style), simplify it...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Simplify Path | Darren's Blog



Given an absolute path for a file (Unix-style), simplify it.

For example,

path = "/home/", => "/home"

path = "/a/./b/../../c/", => "/c"

http://ift.tt/1lqtFy9

http://ift.tt/1lqtFyc



LeetCode - Simplify Path | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lqtEdL

via LifeLong Community

LeetCode - Climbing Stairs | Darren's Blog You are climbing a stair case. It takes n steps to reach ...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Climbing Stairs | Darren's Blog

You are climbing a stair case. It takes n steps 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?

http://ift.tt/1lqtDGK

http://ift.tt/1pCnl6e



LeetCode - Climbing Stairs | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lqtFhH

via LifeLong Community

My Own Notes: Leetcode: Subsets II Given a collection of integers that might contain duplicates, S, ...

Please Visit: http://ift.tt/1ajReyV



My Own Notes: Leetcode: Subsets II

Given a collection of integers that might contain duplicates, 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 example,If S = [1,2,2], a solution is:

[

[2],

[1],

[1,2,2],

[2,2],

[1,2],

[]

]

http://ift.tt/1qbgRPp

http://ift.tt/1qbgPqI



My Own Notes: Leetcode: Subsets II







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1o4mjAn

via LifeLong Community

LeetCode – Subsets (Java) Given a set of distinct integers, S, return all possible subsets. http://w...

Please Visit: http://ift.tt/1ajReyV



LeetCode – Subsets (Java)

Given a set of distinct integers, S, return all possible subsets.

http://ift.tt/1lTTDLH

http://ift.tt/Tjqa18



LeetCode – Subsets (Java)







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/TjqdtH

via LifeLong Community

LeetCode - Permutations II | Darren's Blog Given a collection of numbers that might contain duplicates...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Permutations II | Darren's Blog



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].

http://ift.tt/1lTTDeS

http://ift.tt/1lTTDv6



LeetCode - Permutations II | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/Tjq9KB

via LifeLong Community

LeetCode - Permutations | Darren's Blog Given a collection of numbers, return all possible permutations...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Permutations | Darren's Blog



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]

http://ift.tt/TjqcG9

http://ift.tt/1lTTA2A



LeetCode - Permutations | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/TjqcGj

via LifeLong Community

[leet code] Combinations - 伪技回忆录 - 博客频道 - CSDN.NET Given two integers n and k, return all possible c...

Please Visit: http://ift.tt/1ajReyV



[leet code] Combinations - 伪技回忆录 - 博客频道 - CSDN.NET

Given two integers n and k, return all possible combinations of k numbers out of 1 ... n

http://ift.tt/Tjqc9b

http://ift.tt/Tjqc9d



[leet code] Combinations - 伪技回忆录 - 博客频道 - CSDN.NET







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lTTAzG

via LifeLong Community

LeetCode - Search in Rotated Sorted Array II | Darren's Blog Follow up for LeetCode - Search in Rotated...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Search in Rotated Sorted Array II | Darren's Blog

Follow up for LeetCode - Search in Rotated Sorted Array (Link->http://ift.tt/1l9h262) : 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 array.

http://ift.tt/1pM1MSC

http://ift.tt/1l9h2mm



LeetCode - Search in Rotated Sorted Array II | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1l9h4Lb

via LifeLong Community

Searching an Element in a Rotated Sorted Array | LeetCode Suppose a sorted array is rotated at some ...

Please Visit: http://ift.tt/1ajReyV



Searching an Element in a Rotated Sorted Array | LeetCode

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). How do you find an element in the rotated array efficiently? You may assume no duplicate exists in the array.

http://ift.tt/1pM1Od6

http://ift.tt/1pM1Od7



Searching an Element in a Rotated Sorted Array | LeetCode







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1l9h1Pr

via LifeLong Community

Largest Rectangular Area in a Histogram | Set 2 | GeeksforGeeks 1) Create an empty stack. 2) Start ...

Please Visit: http://ift.tt/1ajReyV



Largest Rectangular Area in a Histogram | Set 2 | GeeksforGeeks



1) Create an empty stack.

2) Start from first bar, and do following for every bar ‘hist[i]‘ where ‘i’ varies from 0 to n-1.

……a) If stack is empty or hist[i] is higher than the bar at top of stack, then push ‘i’ to stack.

……b) If this bar is smaller than the top of stack, then keep removing the top of stack while top of the stack is greater. Let the removed bar be hist[tp]. Calculate area of rectangle with hist[tp] as smallest bar. For hist[tp], the ‘left index’ is previous (previous to tp) item in stack and ‘right index’ is ‘i’ (current index).

3) If the stack is not empty, then one by one remove all bars from stack and do step 2.b for every removed bar.

http://ift.tt/1pM1NWH

http://ift.tt/1pM1Mly



Largest Rectangular Area in a Histogram | Set 2 | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1l9h4e1

via LifeLong Community

Largest Rectangular Area in a Histogram | Set 1 | GeeksforGeeks Find the largest rectangular area possible...

Please Visit: http://ift.tt/1ajReyV



Largest Rectangular Area in a Histogram | Set 1 | GeeksforGeeks



Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity, assume that all bars have same width and the width is 1 unit.

http://ift.tt/1pM1NWy

http://ift.tt/1l9h1im



Largest Rectangular Area in a Histogram | Set 1 | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1l9h1iq

via LifeLong Community

Create full screen view with screenfull.js | w3resource http://ift.tt/1l9h11O...

Please Visit: http://ift.tt/1ajReyV



Create full screen view with screenfull.js | w3resource

http://ift.tt/1l9h3GZ



Create full screen view with screenfull.js | w3resource







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pM1M4W

via LifeLong Community

How to Use the HTML5 Full-Screen API (Again) - SitePoint http://ift.tt/1l9h3qq...

Please Visit: http://ift.tt/1ajReyV



How to Use the HTML5 Full-Screen API (Again) - SitePoint

http://ift.tt/1fCw1GH



How to Use the HTML5 Full-Screen API (Again) - SitePoint







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pM1LOs

via LifeLong Community

LeetCode - Remove Duplicates from Sorted List II | Darren's Blog Given a sorted linked list, delete...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Remove Duplicates from Sorted List II | Darren's Blog



Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.

For example,

Given 1->2->3->3->4->4->5, return 1->2->5.

Given 1->1->1->2->3, return 2->3.

http://ift.tt/1pM1Lhz

http://ift.tt/1pM1LxP



LeetCode - Remove Duplicates from Sorted List II | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1l9h0uP

via LifeLong Community

LeetCode - Triangle | Darren's Blog Given a triangle, find the minimum path sum from top to bottom. ...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Triangle | Darren's Blog

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below

http://ift.tt/1lPUwFe

http://ift.tt/1mcZl5H



LeetCode - Triangle | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mcZmqh

via LifeLong Community

LeetCode - Restore IP Addresses | Darren's Blog Given a string containing only digits, restore it by...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Restore IP Addresses | Darren's Blog



Given a string containing only digits, restore it by returning all possible valid IP address combinations.

For example: given "25525511135", return ["255.255.11.135", "255.255.111.35"]. (Order does not matter)

Note: according to the feedback from the test cases, any part that is in the form of '0x' or '0xx' is not valid.

http://ift.tt/1mcZkPf

http://ift.tt/1lPUwoD



LeetCode - Restore IP Addresses | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mcZjuF

via LifeLong Community

LeetCode - Decode Ways | Darren's Blog A message containing letters from A-Z is being encoded to numbers...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Decode Ways | Darren's Blog



A message containing letters from A-Z is being encoded to numbers using the following mapping:







Java



'A' -> 1

'B' -> 2

...

'Z' -> 26









1234



'A' -> 1'B' -> 2...'Z' -> 26









Given an encoded message containing digits, determine the total number of ways to decode it.

http://ift.tt/1lPUw7Z

http://ift.tt/1mcZkP7



LeetCode - Decode Ways | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lPUxsA

via LifeLong Community

水中的鱼: [LeetCode] Gray Code 解题报告 The gray code is a binary numeral system where two successive values...

Please Visit: http://ift.tt/1ajReyV



水中的鱼: [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 gray code. A gray code sequence must begin with 0.

For example, given n = 2, return [0,1,3,2]. Its gray code sequence is:

00 - 0

01 - 1

11 - 3

10 - 2

http://ift.tt/1lPUtZO

Done



水中的鱼: [LeetCode] Gray Code 解题报告







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1mcZkhX

via LifeLong Community

Why Future Generations Will Hate You for Using java.util.Stack | Javalobby http://ift.tt/1ml0hcW...

Please Visit: http://ift.tt/1ajReyV



Why Future Generations Will Hate You for Using java.util.Stack | Javalobby

http://ift.tt/TtArIs



Why Future Generations Will Hate You for Using java.util.Stack | Javalobby







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1ml0hcZ

via LifeLong Community

Java Stack vs Deque - bad.robot http://ift.tt/TtArbi

Please Visit: http://ift.tt/1ajReyV



Java Stack vs Deque - bad.robot

http://ift.tt/TtArbi



Java Stack vs Deque - bad.robot







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1ml0gWh

via LifeLong Community

Complete Java Collection tutorial for the beginner | Shiva Blog http://ift.tt/TtArIn...

Please Visit: http://ift.tt/1ajReyV



Complete Java Collection tutorial for the beginner | Shiva Blog

http://ift.tt/1ml0gpn



Complete Java Collection tutorial for the beginner | Shiva Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/TtAqUM

via LifeLong Community

LeetCode - Binary Tree Preorder Traversal | Darren's Blog Given a binary tree, return the preorder traversal...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Binary Tree Preorder Traversal | Darren's Blog

Given a binary tree, return the preorder traversal of its nodes' values.

http://ift.tt/TtAqEk

http://ift.tt/TtArs1



LeetCode - Binary Tree Preorder Traversal | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/TtAqEm

via LifeLong Community

LeetCode - Binary Tree Level Order Traversal | Darren's Blog Given a binary tree, return the level order...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Binary Tree Level Order Traversal | Darren's Blog

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level

http://ift.tt/1ml0fBU

http://ift.tt/1ml0fBY



LeetCode - Binary Tree Level Order Traversal | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1ml0fSc

via LifeLong Community

Sorted Linked List to Balanced BST | GeeksforGeeks Given a Singly Linked List which has data members...

Please Visit: http://ift.tt/1ajReyV



Sorted Linked List to Balanced BST | GeeksforGeeks



Given a Singly Linked List which has data members sorted in ascending order. Construct a Balanced Binary Search Tree (Link->http://ift.tt/TtAowa) which has same data members as the given Linked List.

http://ift.tt/1ml0eO9

http://ift.tt/1ml0flb



Sorted Linked List to Balanced BST | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1ml0flf

via LifeLong Community
Please Visit: http://ift.tt/1ajReyV



LeetCode - Path Sum II | Darren's Blog

public ArrayList<ArrayList<Integer>> pathSum(TreeNode root, int sum) { ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>(); if (root == null) return result; recursivePathSum(root, sum, new ArrayList<Integer>(), result); return result; } /** * Recursively find all paths whose sum is given * @param root the root of a tree * @param sum the given sum * @param current values of the nodes in the current path * @param result a list that stores all such paths */ private void recursivePathSum(TreeNode root, int sum, ArrayList<Integer> current, ArrayList<ArrayList<Integer>> result) { if (root == null) // Empty tree return; // It is a leaf and its value is the path sum if (root.val == sum && root.left == null && root.right == null) { // Add the node into the current path, and store that path before recover the path current.add(root.val); result.add(new ArrayList<Integer>(current)); current.remove(current.size()-1); return; } // Add the node into the current path, and explore its left subtree and right subtree // before recover the path current.add(root.val); recursivePathSum(root.left, sum-root.val, current, result); recursivePathSum(root.right, sum-root.val, current, result); current.remove(current.size()-1); }

http://ift.tt/TsmD0L

http://ift.tt/TsmD0P



LeetCode - Path Sum II | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lncZHY

via LifeLong Community

Leetcode: Populating Next Right Pointers in Each Node II (java) - Muscler的专栏 - 博客频道 - CSDN.NET Follow...

Please Visit: http://ift.tt/1ajReyV



Leetcode: Populating Next Right Pointers in Each Node II (java) - Muscler的专栏 - 博客频道 - CSDN.NET



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 extra space.

For example,

Given the following binary tree,

1

/ \

2 3

/ \ \

4 5 7

After calling your function, the tree should look like:

1 -> NULL

/ \

2 -> 3 -> NULL

/ \ \

4-> 5 -> 7 -> NULL

http://ift.tt/TrV6wu

http://ift.tt/TrV9sh



Leetcode: Populating Next Right Pointers in Each Node II (java) - Muscler的专栏 - 博客频道 - CSDN.NET







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1itxdR6

via LifeLong Community

LeetCode - Populating Next Right Pointers in Each Node | Darren's Blog Populate each next pointer to...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Populating Next Right Pointers in Each Node | Darren's Blog



Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL. Initially, all next pointers are set to NULL.

Note:

You may only use constant extra space.

You may assume that it is a perfect binary tree (ie, all leaves are at the same level, and every parent has two children).

http://ift.tt/TrV8o3

http://ift.tt/TrV5sq



LeetCode - Populating Next Right Pointers in Each Node | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/TrV8o6

via LifeLong Community

LeetCode - Flatten Binary Tree to Linked List | Darren's Blog Given a binary tree, flatten it to a ...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Flatten Binary Tree to Linked List | Darren's Blog



Given a binary tree, flatten it to a linked list in-place.

http://ift.tt/TrV7R6

http://ift.tt/TrV87G



LeetCode - Flatten Binary Tree to Linked List | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/TrV4Vq

via LifeLong Community

LeetCode - Pascal's Triangle II | Darren's Blog Given an index k, return the k-th row of the Pascal's...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Pascal's Triangle II | Darren's Blog

Given an index k, return the k-th row of the Pascal's triangle. For example, given k = 3, return [1,3,3,1]

http://ift.tt/V7T85X

http://ift.tt/V7T85Z



LeetCode - Pascal's Triangle II | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1v09acy

via LifeLong Community

LeetCode - Best Time to Buy and Sell Stock III | Darren's Blog Say you have an array for which the ...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Best Time to Buy and Sell Stock III | Darren's Blog



Say you have an array for which the i-th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions.

Note: You may not engage in multiple transactions at the same time (i.e., you must sell the stock before you buy again)

http://ift.tt/1v099VR

http://ift.tt/1v098Bp



LeetCode - Best Time to Buy and Sell Stock III | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/V7T7Pv

via LifeLong Community

LeetCode - Palindrome Number | Darren's Blog Determine whether an integer is a palindrome. Do this ...

Please Visit: http://ift.tt/1ajReyV



LeetCode - Palindrome Number | Darren's Blog



Determine whether an integer is a palindrome. Do this without extra space. Assume that a negative integer is not a palindrome.

http://ift.tt/1v099Fm

http://ift.tt/1v099Fo



LeetCode - Palindrome Number | Darren's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/V7T7yX

via LifeLong Community

Reverse a Linked List in groups of given size | GeeksforGeeks Given a linked list, write a function...

Please Visit: http://ift.tt/1ajReyV



Reverse a Linked List in groups of given size | GeeksforGeeks



Given a linked list, write a function to reverse every k nodes (where k is an input to the function).

http://ift.tt/1pGQw9W

http://ift.tt/1wq8Hmr



Reverse a Linked List in groups of given size | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pGQy1K

via LifeLong Community

西小瓜: Leetcode: Letter Combinations of a Phone Number Given a digit string, return all possible letter...

Please Visit: http://ift.tt/1ajReyV



西小瓜: Leetcode: Letter Combinations of a Phone Number

Given a digit string, return all possible letter combinations that the number could represent.

http://ift.tt/1pGQxL3

http://ift.tt/1pGQvD4



西小瓜: Leetcode: Letter Combinations of a Phone Number







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pGQvD8

via LifeLong Community

LeetCode: Longest Common Prefix in Java | Param's Blog http://ift.tt/1wq8Feg...

Please Visit: http://ift.tt/1ajReyV



LeetCode: Longest Common Prefix in Java | Param's Blog

http://ift.tt/1wq8DD7



LeetCode: Longest Common Prefix in Java | Param's Blog







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pGQuix

via LifeLong Community

Yu's Coding Garden : leetcode Question 5: Add Two Numbers You are given two linked lists representing...

Please Visit: http://ift.tt/1ajReyV



Yu's Coding Garden : leetcode Question 5: Add Two Numbers

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 linked list.

Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)

Output: 7 -> 0 -> 8

http://ift.tt/1pGp6RJ

http://ift.tt/1pw5KwC



Yu's Coding Garden : leetcode Question 5: Add Two Numbers







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pw5KwE

via LifeLong Community

Yu's Coding Garden : leetcode Question 61: Next permutation Implement next permutation, which rearranges...

Please Visit: http://ift.tt/1ajReyV



Yu's Coding Garden : leetcode Question 61: 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 order (ie, sorted in ascending order).

The replacement must be in-place, do not allocate extra memory.

Here are some examples. Inputs are in the left-hand column and its corresponding outputs are in the right-hand column.1,2,3 → 1,3,23,2,1 → 1,2,31,1,5 → 1,5,1

http://ift.tt/1pGp4sV

http://ift.tt/1pGp6Bd



Yu's Coding Garden : leetcode Question 61: Next permutation







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pGp4sZ

via LifeLong Community

Yu's Coding Garden : leetcode Question 68: Permutation Sequence The set [1,2,3,…,n] contains a total...

Please Visit: http://ift.tt/1ajReyV



Yu's Coding Garden : leetcode Question 68: Permutation Sequence

The set [1,2,3,…,n] contains a total of n! unique permutations.

By listing and labeling all of the permutations in order,

We get the following sequence (ie, for n = 3):

"123"

"132"

"213"

"231"

"312"

"321"

Given n and k, return the kth permutation sequence.

http://ift.tt/1bgrZUN

http://ift.tt/1pw5JIY



Yu's Coding Garden : leetcode Question 68: Permutation Sequence







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pw5JJ0

via LifeLong Community

LeetCode – Maximum Subarray (Java) Find the contiguous subarray within an array (containing at least...

Please Visit: http://ift.tt/1ajReyV



LeetCode – Maximum Subarray (Java)



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] has the largest sum = 6.

http://ift.tt/1pGp3VY

http://ift.tt/1pw5H3Y



LeetCode – Maximum Subarray (Java)







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pw5Jc8

via LifeLong Community

Divide and Conquer | Set 3 (Maximum Subarray Sum) | GeeksforGeeks You are given a one dimensional array...

Please Visit: http://ift.tt/1ajReyV



Divide and Conquer | Set 3 (Maximum Subarray Sum) | GeeksforGeeks



You are given a one dimensional array that may contain both positive and negative integers, find the sum of contiguous subarray of numbers which has the largest sum.

http://ift.tt/1uZ7b8a

http://ift.tt/UCfKej



Divide and Conquer | Set 3 (Maximum Subarray Sum) | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/UCfN9P

via LifeLong Community

My Leetcode: Binary Tree Maximum Path Sum (Java) Preorderly traverse the whole tree. For each node calculate...

Please Visit: http://ift.tt/1ajReyV



My Leetcode: Binary Tree Maximum Path Sum (Java)

Preorderly traverse the whole tree. For each node calculate Max(root, root+leftSide, root+rightSide, leftSide+root+rightSide ), update max[0] (which is used to store max value), then return Max (root+leftSide, root+rightSide, root)

http://ift.tt/1uZ7aRF

http://ift.tt/UCfJHi



My Leetcode: Binary Tree Maximum Path Sum (Java)







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/UCfMCZ

via LifeLong Community

LeetCode – Permutations II (Java) Given a collection of numbers that might contain duplicates, return...

Please Visit: http://ift.tt/1ajReyV



LeetCode – Permutations II (Java)



Given a collection of numbers that might contain duplicates, return all possible unique permutations.

http://ift.tt/UCfITw

http://ift.tt/1uZ7akR



LeetCode – Permutations II (Java)







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/UCfLPc

via LifeLong Community

LeetCode – Permutations (Java) Given a collection of numbers, return all possible permutations. http...

Please Visit: http://ift.tt/1ajReyV



LeetCode – Permutations (Java)



Given a collection of numbers, return all possible permutations.

http://ift.tt/1pFzSYr

http://ift.tt/1pvzWI9



LeetCode – Permutations (Java)







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pFzSYu

via LifeLong Community

Java Priority Queue (PriorityQueue) Example http://ift.tt/1pFzV6C...

Please Visit: http://ift.tt/1ajReyV



Java Priority Queue (PriorityQueue) Example

http://ift.tt/1pvzTMw



Java Priority Queue (PriorityQueue) Example







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pvzTMy

via LifeLong Community

LeetCode – Merge k Sorted Lists (Java) Merge k sorted linked lists and return it as one sorted list...

Please Visit: http://ift.tt/1ajReyV



LeetCode – Merge k Sorted Lists (Java)



Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.

http://ift.tt/1lKwlXw

http://ift.tt/1pFzUQ0



LeetCode – Merge k Sorted Lists (Java)







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pvzWrE

via LifeLong Community

Splay Trees A splay tree is a binary search tree. It has one interesting difference, however: whenever...

Please Visit: http://ift.tt/1ajReyV



Splay Trees



A splay tree is a binary search tree. It has one interesting difference, however: whenever an element is looked up in the tree, the splay tree reorganizes to move that element to the root of the tree, without breaking the binary search tree invariant. If the next lookup request is for the same element, it can be returned immediately. In general, if a small number of elements are being heavily used, they will tend to be found near the top of the tree and are thus found quickly.

http://ift.tt/1pvzVUM

http://ift.tt/1pFzRUo



Splay Trees







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pvzTfr

via LifeLong Community

Longest prefix matching - A Trie based solution in Java | GeeksforGeeks Given a dictionary of words...

Please Visit: http://ift.tt/1ajReyV



Longest prefix matching - A Trie based solution in Java | GeeksforGeeks



Given a dictionary of words and an input string, find the longest prefix of the string which is also a word in dictionary.

http://ift.tt/1uYlEkZ

http://ift.tt/1uYlEBe



Longest prefix matching - A Trie based solution in Java | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/UBmGIF

via LifeLong Community

B-Tree | Set 1 (Introduction) | GeeksforGeeks http://ift.tt/UBmJnG...

Please Visit: http://ift.tt/1ajReyV



B-Tree | Set 1 (Introduction) | GeeksforGeeks

http://ift.tt/1gWFi9E



B-Tree | Set 1 (Introduction) | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/UBmJnM

via LifeLong Community

Algorithm Tutorials http://ift.tt/1g9iNkM...

Please Visit: http://ift.tt/1ajReyV



Algorithm Tutorials

http://ift.tt/1g9iNkM



Algorithm Tutorials







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1uYlE4h

via LifeLong Community

Segment Tree | Set 2 (Range Minimum Query) | GeeksforGeeks We have an array arr[0 . . . n-1]. We should...

Please Visit: http://ift.tt/1ajReyV



Segment Tree | Set 2 (Range Minimum Query) | GeeksforGeeks



We have an array arr[0 . . . n-1]. We should be able to efficiently find the minimum value from index qs (query start) to qe (query end) where 0 <= qs <= qe <= n-1. The array is static (elements are not deleted and inserted during the series of queries).

http://ift.tt/1wnHcdi

http://ift.tt/1paOdhR



Segment Tree | Set 2 (Range Minimum Query) | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1wnHctC

via LifeLong Community

Reservoir Sampling | GeeksforGeeks It can be solved in O(n) time. The solution also suits well for input...

Please Visit: http://ift.tt/1ajReyV



Reservoir Sampling | GeeksforGeeks

It can be solved in O(n) time. The solution also suits well for input in the form of stream. The idea is similar to this (Link->http://ift.tt/Uyxg2Z) post. Following are the steps.

1) Create an array reservoir[0..k-1] and copy first k items of stream[] to it.

2) Now one by one consider all items from (k+1)th item to nth item.

…a) Generate a random number from 0 to i where i is index of current item in stream[]. Let the generated random number is j.

…b) If j is in range 0 to k-1, replace reservoir[j] with arr[i]

http://ift.tt/MxNpkB

http://ift.tt/Uyxg35



Reservoir Sampling | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1roNpmw

via LifeLong Community

*Find the largest multiple of 2, 3 and 5 | GeeksforGeeks*An array of size n is given. The array contains...

Please Visit: http://ift.tt/1ajReyV



*Find the largest multiple of 2, 3 and 5 | GeeksforGeeks*An array of size n is given. The array contains digits from 0 to 9. Generate the largest number using the digits in the array such that the number is divisible by 2, 3 and 5.

http://ift.tt/1ptadQG

http://ift.tt/1pBY4L2



Find the largest multiple of 2, 3 and 5 | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1ptacfG

via LifeLong Community

Efficient program to print all prime factors of a given number Given a number n, write an efficient ...

Please Visit: http://ift.tt/1ajReyV



Efficient program to print all prime factors of a given number

Given a number n, write an efficient function to print all prime factors (Link->http://ift.tt/1pBY2TB) of n. For example, if the input number is 12, then output should be “2 2 3″. And if the input number is 315, then output should be “3 3 5 7″.

http://ift.tt/1pBY4eg

http://ift.tt/1ptabIE



Efficient program to print all prime factors of a given number







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pBY4ej

via LifeLong Community

Russian Peasant Multiplication | GeeksforGeeks Given two integers, write a function to multiply them...

Please Visit: http://ift.tt/1ajReyV



Russian Peasant Multiplication | GeeksforGeeks

Given two integers, write a function to multiply them without using multiplication operator.

There are many other ways to multiply two numbers (For example, see Russian peasant algorithm (Link->http://ift.tt/1nugx9d) . The idea is to double the first number and halve the second number repeatedly till the second number doesn’t become 1. In the process, whenever the second number become odd, we add the first number to result (result is initialized as 0)

http://ift.tt/1pYhDz3

http://ift.tt/1nugx9f



Russian Peasant Multiplication | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1pYhBHq

via LifeLong Community