[google] the smallest range from k lists
http://www.careercup.com/question?id=16759664 You have k lists of sorted integers. Find the smallest range that includes at least one number from each of the k lists. For example, List 1: [4, 10, 15, 24, 26] List 2: [0, 9, 12, 20] List 3: [5, 18, 22, 30] The smallest range here would be [20, 24] as it contains 24 from list 1, 20 from list 2, and 22 from list 3.
더보기
[Oj.leetcode] generate-parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: "((()))", "(()())", "(())()", "()(())", "()()()" /* "well-formed" 의미를 시작전 명확하게 인터뷰어와 논의. 여기서는 열고( 닫는) 한쌍의 괄호쌍 의미 좀 더 정확하게 정의해보면, 닫힌 괄호가 나왔을때, 앞에 매칭되는 열린괄호가 최소한 1개는 존재해야함. n=1 (), n=2 (()), ()() n=3 ()(()), (()()), ((())), (()()), (())(), ()()() n=4 ..
더보기