- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 Sort Colors
Question: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the
2012-12-27 10:55:56 3611
原创 Spiral Matrix
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the following matrix: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [
2012-12-21 00:57:33 1803
原创 Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in t
2012-12-21 00:55:35 1814
原创 Minimum Path Sum
Question: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either dow
2012-12-21 00:54:20 1959
原创 Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total numb
2012-12-21 00:53:20 1870
原创 Closest node to the target in BST
Question: Give a BST, find a node whose value is closest to the target. public static int closestValue(Node root, int value, int maxDiff) { if (root == null) return Integer.MAX_VALUE; int tempDiff
2012-12-21 00:50:43 2121
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人