Toggle navigation
Marcy Blog
Home
About
Prepare Code Interview
Tags
Marcy Blog
Failed to be a geek
Problem: Kth Smallest Element in a Sorted Matrix
Question Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted...
Problem: Task Scheduler
Question Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be done without original order. Each...
Problem: Reorganize String
Question Given a string S, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same. If possible, output any possible result. If not possibl...
Problem: Find K Pairs with Smallest Sums
Question You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element from the first array and one element from t...
Problem: Find Median from Data Stream
Question Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. For example, [2,3,4],...
Problem: Merge K Sorted Lists
Question Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Priority Queue Solution TODO Code class Solution { public ListNode mergeKLists(Lis...
Problem: Meeting Rooms II
Question Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required. For example, Given [[...
Problem: Top K Frequent Words
Question Given a non-empty list of words, return the k most frequent elements. Your answer should be sorted by frequency from highest to lowest. If two words have the same frequency, then the wor...
Problem: Kth Largest Element in an Array
Question Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For example, Given [3,2,1,5,6,4] and k = 2, r...
Problem: Maximal Rectangle
Question Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1 ...
← 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