摘要:
The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. Given the Em
阅读全文
posted @ 2016-04-05 11:21
Grandyang
阅读(3884)
推荐(1)
摘要:
Write a SQL query to find all numbers that appear at least three times consecutively. For example, given the above Logs table, 1 is the only number th
阅读全文
posted @ 2016-04-05 10:51
Grandyang
阅读(6391)
推荐(0)
摘要:
Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking num
阅读全文
posted @ 2016-04-04 11:20
Grandyang
阅读(14194)
推荐(0)
摘要:
Building #11 is undergoing a major renovation. Implement a query to close all requests from apartments in this building. -- TABLE Apartments -- TABLE
阅读全文
posted @ 2016-04-04 09:18
Grandyang
阅读(516)
推荐(0)
摘要:
Write a SQL query to get a list of all buildings and the number of open requests (Requests in which status equals 'Open'). -- TABLE Apartments -- TABL
阅读全文
posted @ 2016-04-04 08:44
Grandyang
阅读(404)
推荐(0)
摘要:
Given a string, find the length of the longest substring T that contains at most k distinct characters. Example 1: Input: s = "eceba", k = 2 Output: 3
阅读全文
posted @ 2016-04-04 08:22
Grandyang
阅读(27216)
推荐(2)
摘要:
Write a SQL query to get a list of tenants who are renting more than one apartment. -- TABLE Apartments -- TABLE Buildings -- TABLE Tenants -- TABLE C
阅读全文
posted @ 2016-04-03 08:32
Grandyang
阅读(600)
推荐(0)
摘要:
Write a SQL query to get the nth highest salary from the Employee table. For example, given the above Employee table, the nth highest salary where n =
阅读全文
posted @ 2016-04-03 05:43
Grandyang
阅读(10430)
推荐(1)
摘要:
Write a SQL query to get the second highest salary from the Employee table. For example, given the above Employee table, the second highest salary is
阅读全文
posted @ 2016-04-03 05:00
Grandyang
阅读(11381)
推荐(1)
摘要:
Table: Person Table: Address Write a SQL query for a report that provides the following information for each person in the Person table, regardless if
阅读全文
posted @ 2016-04-03 04:09
Grandyang
阅读(6369)
推荐(1)
摘要:
在SQL语言中,存在着各种Join,有Left Join, Right Join, Inner Join, and Natural Join等,对于初学者来说肯定一头雾水,都是神马跟神马啊,它们之间到底有着怎样的区别和联系呢,我们先用一张图片来说明: 上面这张图很好的阐释了Left Join, Ri
阅读全文
posted @ 2016-04-02 09:33
Grandyang
阅读(11438)
推荐(0)
摘要:
More Information Check: http://blog.csdn.net/ithomer/article/details/5131863
阅读全文
posted @ 2016-04-01 03:24
Grandyang
阅读(3514)
推荐(0)
摘要:
Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list -- w
阅读全文
posted @ 2016-03-31 10:57
Grandyang
阅读(17573)
推荐(1)
摘要:
Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead. Note:The sum of
阅读全文
posted @ 2016-03-30 12:14
Grandyang
阅读(21312)
推荐(0)
摘要:
Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer n and return all possib
阅读全文
posted @ 2016-03-29 13:55
Grandyang
阅读(14507)
推荐(0)
摘要:
I am using VTK 5.10.1 with VS 2010, and the following example does not work on my machine: http://www.vtk.org/Wiki/VTK/Examples/Cxx/ImageData/IterateI
阅读全文
posted @ 2016-03-29 01:07
Grandyang
阅读(2083)
推荐(0)
摘要:
Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary search tree. You may assume each number in the seq
阅读全文
posted @ 2016-03-28 05:55
Grandyang
阅读(12939)
推荐(0)
摘要:
Given a pattern and a string str, find if strfollows the same pattern. Here follow means a full match, such that there is a bijection between a letter
阅读全文
posted @ 2016-03-27 15:14
Grandyang
阅读(12955)
推荐(1)
摘要:
There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. Yo
阅读全文
posted @ 2016-03-26 14:26
Grandyang
阅读(16365)
推荐(0)
摘要:
There are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a certai
阅读全文
posted @ 2016-03-25 14:30
Grandyang
阅读(18977)
推荐(0)
摘要:
Given a string s, return all the palindromic permutations (without duplicates) of it. Return an empty list if no palindromic permutation could be form
阅读全文
posted @ 2016-03-24 13:51
Grandyang
阅读(12562)
推荐(0)
摘要:
Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is tha
阅读全文
posted @ 2016-03-23 13:00
Grandyang
阅读(21735)
推荐(1)
摘要:
Given a binary search tree and a node in it, find the in-order successor of that node in the BST. The successor of a node p is the node with the small
阅读全文
posted @ 2016-03-22 13:49
Grandyang
阅读(20462)
推荐(0)
摘要:
Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2
阅读全文
posted @ 2016-03-21 03:36
Grandyang
阅读(18654)
推荐(0)
摘要:
You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You can only move up, down, left and right.
阅读全文
posted @ 2016-03-20 14:14
Grandyang
阅读(23339)
推荐(0)
摘要:
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r
阅读全文
posted @ 2016-03-19 07:05
Grandyang
阅读(21563)
推荐(1)
摘要:
A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the h
阅读全文
posted @ 2016-03-18 10:28
Grandyang
阅读(17268)
推荐(0)
摘要:
You are given a m x n 2D grid initialized with these three possible values. Fill each empty room with the distance to its nearest gate. If it is impos
阅读全文
posted @ 2016-03-17 01:03
Grandyang
阅读(23283)
推荐(1)
摘要:
Given two sparse matrices A and B, return the result of AB. You may assume that A's column number is equal to B's row number. Example: A = [ [ 1, 0, 0
阅读全文
posted @ 2016-03-16 12:26
Grandyang
阅读(25940)
推荐(0)
摘要:
Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column). If two nodes are in the sam
阅读全文
posted @ 2016-03-15 12:31
Grandyang
阅读(19874)
推荐(0)
摘要:
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each hou
阅读全文
posted @ 2016-03-14 11:32
Grandyang
阅读(23910)
推荐(2)
摘要:
Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i]
阅读全文
posted @ 2016-03-13 15:00
Grandyang
阅读(23013)
推荐(2)
摘要:
An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black pixels are connected, i.e., there is only one bla
阅读全文
posted @ 2016-03-12 15:05
Grandyang
阅读(10993)
推荐(0)
摘要:
Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list
阅读全文
posted @ 2016-03-11 14:46
Grandyang
阅读(15745)
推荐(0)
摘要:
Write a function to generate the generalized abbreviations of a word. Note: The order of the output does not matter. Example: Input: "word" Output: ["
阅读全文
posted @ 2016-03-10 13:29
Grandyang
阅读(13587)
推荐(1)
摘要:
Given n nodes labeled from 0 to n-1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make
阅读全文
posted @ 2016-03-09 13:56
Grandyang
阅读(30741)
推荐(0)
摘要:
Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starting node to any
阅读全文
posted @ 2016-03-08 05:14
Grandyang
阅读(16154)
推荐(0)
摘要:
There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of non-empty word
阅读全文
posted @ 2016-03-07 13:35
Grandyang
阅读(29574)
推荐(0)
摘要:
Given a non-empty binary search tree and a target value, find k values in the BST that are closest to the target. Note: Given target value is a floati
阅读全文
posted @ 2016-03-06 14:32
Grandyang
阅读(18612)
推荐(1)
摘要:
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 room
阅读全文
posted @ 2016-03-05 13:58
Grandyang
阅读(56776)
推荐(1)