Stack

­

Stack

A stack is a container of objects that are inserted and removed according to the last-in first-out (LIFO) principle.

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

[Leetcode] Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

November 14th, 2015|Categories: DS and Algorithms, Stack, String|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 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] Implement Queue using Stacks

Implement the following operations of a queue using stacks.

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

[Leetcode] Implement Stack using Queues

Implement the following operations of a stack using queues: push(x), poll(), empty(), peek().

December 10th, 2015|Categories: DS and Algorithms, Queue, Stack|Tags: , , , , |

[Leetcode] Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

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

[Leetcode] Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST

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

[Leetcode] Basic Calculator

Implement a basic calculator to evaluate a simple expression string.

November 22nd, 2015|Categories: DS and Algorithms, Math, Stack|Tags: , , |

[Leetcode] Basic Calculator II

Implement a basic calculator to evaluate a simple expression string with '+','-','*','/'.

November 22nd, 2015|Categories: DS and Algorithms, Math, Stack|Tags: , , |