Toggle navigation
Marcy Blog
Home
About
Prepare Code Interview
Tags
Marcy Blog
Failed to be a geek
Problem: Flatten Nested List Iterator
Question Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list – whose elements may also be integers or other lists. Example 1: Input...
Problem: Largest Rectangle in Histogram
Question Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram. Above is a histogram where ...
Problem: Maximum Frequency Stack
Question Implement FreqStack, a class which simulates the operation of a stack-like data structure. FreqStack has two functions: push(int x), which pushes an integer x onto the stack. pop()...
Problem: Next Greater Element II
Question Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Number of a number x is ...
Problem: Next Greater Element I
Question You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding place...
Problem: Daily Temperatures
Question Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future ...
Problem: Design Circular Queue
Question Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle and the ...
Problem: Valid Parenthese
Question Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are...
Problem: Evaluate Reverse Polish Notation
Question Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another expression. Some examples: ["2", "...
Problem: Min Stack
Question 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 stac...
← Newer Posts
Older Posts →
FEATURED TAGS
Life
Ruby on Rails
Project Management
Agile
Ruby
OOP
Design Patterns
ABOUT ME
To be a top coder, a proud father, and a better man