发布了文章2019-01-14
Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between 1 and 2^h nodes inclusive a...
发布了文章2019-01-14
Find the total area covered by two rectilinear rectangles in a 2D plane.
发布了文章2019-01-14
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
发布了文章2019-01-14
Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
发布了文章2019-01-14
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.
发布了文章2019-01-14
You have an array of logs. Each log is a space delimited string of words.
发布了文章2019-01-14
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.
发布了文章2019-01-14
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.
发布了文章2019-01-14
Compare two version numbers version1 and version2.If version1 > version2 return 1; if version1 < version2 return -1;otherwise return 0.
发布了文章2019-01-14
Given a binary tree, return the values of its boundary in anti-clockwise direction starting from root. Boundary includes left boundary, leaves, and right boundary in order without duplicate nodes.
发布了文章2019-01-14
Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
发布了文章2018-12-31
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.
发布了文章2018-12-31
The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix.
发布了文章2018-12-31
Given a non-empty, singly linked list with head node head, return a middle node of linked list.
发布了文章2018-12-31
Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.
发布了文章2018-12-31
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.
发布了文章2018-12-31
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.
发布了文章2018-12-31
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.
发布了文章2018-12-30
Given a linked list, rotate the list to the right by k places, where k is non-negative.
发布了文章2018-12-30
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.