- 博客(7)
- 收藏
- 关注
原创 LeetCode: Pow(x, n)
Implement pow(x, n). class Solution { public: double pow(double x, int n) { double result = helper(x, std::abs(n)); return n > 0 ? result : 1/result; } double hel
2014-12-19 14:47:07 332
原创 LeetCode: N-Queens II
Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. class Solution { public: int totalNQueens(int n) { vect
2014-12-19 13:23:33 478
原创 LeetCode: N-Queens
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. Eac
2014-12-19 12:28:51 612
原创 LeetCode: Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times. E
2014-12-17 15:59:45 326
原创 LeetCode: Merge Intervals
Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18]. /** * Definition for an interval. * struct Inter
2014-12-16 15:23:19 312
原创 LeetCode: Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine i
2014-12-16 06:12:14 308
原创 LeetCode: Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get
2014-12-15 13:39:25 354
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人