Recursion

­

Recursion

Recursion solves a problem by solving one or more sub-states of the problem itself.

November 14th, 2015|Categories: DS and Algorithms, Recursion|Tags: , |

Dynamic Programming Theory

Introduce what is and when to use dynamic programming.

November 14th, 2015|Categories: DS and Algorithms, Dynamic Programming, Recursion|Tags: , |

[Leetcode] Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.

November 14th, 2015|Categories: DS and Algorithms, Graph, Recursion, Tree|Tags: , , , , , |

[Leetcode] Sum Root to Leaf Numbers

Calculate the total sum of all root-to-leaf numbers.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree|Tags: , , , , , |

[Leetcode] Permutations

Given a collection of numbers, return all possible permutations.

November 14th, 2015|Categories: DS and Algorithms, Recursion|Tags: , , , , |

[Leetcode] Invert Binary Tree

Invert a binary tree.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree|Tags: , , , , , |

[Leetcode] Binary Tree Preorder Traversal

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

November 14th, 2015|Categories: DS and Algorithms, Recursion, Stack, Tree|Tags: , , , , , |

[Leetcode] Binary Tree Right Side View

Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree|Tags: , , , , , |

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

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree|Tags: , , , , , |

[Leetcode] Path Sum II

Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree|Tags: , , , , , |

[Leetcode] Letter Combinations of a Phone Number

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

November 14th, 2015|Categories: DS and Algorithms, Hash, Recursion|Tags: , , , |

[Leetcode] Subsets

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

November 14th, 2015|Categories: Array, DS and Algorithms, Recursion|Tags: , , , , , |

[Leetcode] Subsets II

Given a collection of integers that might contain duplicates, nums, return all possible subsets.

November 14th, 2015|Categories: Array, DS and Algorithms, Recursion|Tags: , , , , , |

[Leetcode] Symmetric Tree

Given a binary tree, check whether it is a mirror of itself.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree|Tags: , , , , |

[Leetcode] Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values. (Both recursive and iterative solutions)

November 14th, 2015|Categories: DS and Algorithms, Recursion, Stack|Tags: , , , , , , |

[Leetcode] Combination Sum

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.

November 14th, 2015|Categories: DS and Algorithms, Recursion|Tags: , , , , |

[Leetcode] Combination Sum II

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.

November 14th, 2015|Categories: DS and Algorithms, Recursion|Tags: , , , , |

[Leetcode] Combination Sum III

Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used.

November 29th, 2015|Categories: Array, DS and Algorithms, Recursion, Searching|Tags: , , , , |

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

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

[Leetcode] Different Ways to Add Parentheses

Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.

November 23rd, 2015|Categories: DS and Algorithms, Recursion|Tags: , , , , |