自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 收藏
  • 关注

原创 [算法课课程作业][证明题]

8.3 STINGY SAT is the following problem: given a set of clauses(each a disjunction of literals) and an integer k, find a satisfying assignment in which at most k variables are true, if such an assignm

2017-07-05 10:25:37 413

原创 [week 20][Leetcode]Best Time to Buy and Sell Stock II

Question: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like

2017-07-05 10:01:27 262

原创 [week 19][Leetcode]Jump Game

Question:  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.

2017-07-05 09:55:24 265

原创 [week 18][Leetcode] Clone Graph

Quetion: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled uniquely. We use # as a separat

2017-06-28 15:39:15 363

原创 [week 17][Leetcode][Binary Search] Arranging Coins

Question: You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number of full staircase rows that can be

2017-06-28 15:05:16 255

原创 [week 16][Leetcode][Divide and Conquer] Kth Largest Element in an Array

Question: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For example, Given [3,2,1,5,6,4] and k = 2,

2017-06-28 14:39:46 219

原创 [week 15][Leetcode][Divide and Conquer] Search a 2D Matrix II

Question: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to rig

2017-06-28 13:40:55 281

原创 [week 14][Leetcode][Divide and Conquer] Majority Element

Question: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majorit

2017-06-28 13:24:41 249

原创 [week 13][Leetcode][Divide and Conquer] Pow(x, n)

Question: Implement pow(x, n). Analysis: 首先考虑n与0的关系,如果n=0则应返回1;如果n0,则应返回power(x,n)。另外利用二分法,可以先计算pow(x,n/2),然后在进行一次乘法。 Code: class Solution { public: double myPow(double x, int n)

2017-06-28 10:03:49 324

原创 [week 12][Leetcode][Dynamic Programming] Unique Paths

Question: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to

2017-06-27 01:05:21 229

原创 [week 11][Leetcode][Dynamic Programming] House Robber

Question: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that a

2017-06-26 20:23:11 343

原创 [week 10][Leetcode][Dynamic Programming] Climbing Stairs

Question: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will

2017-06-26 19:06:20 279

原创 [week 9][Leetcode][Dynamic Programming] Best Time to Buy and Sell Stock

Question: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of

2017-06-26 16:07:44 328

原创 [算法课模拟题]1000.函数求值

Question: 定义超级和函数F如下: F(0, n) = n,对于所有的正整数n.. F(k, n) = F(k – 1, 1) + F(k – 1, 2) + … + F(k – 1, n),对于所有的正整数k和n.   请实现下面Solution类中计算F(k, n)的函数(1   class Solution { public:        int F(int

2017-06-26 15:56:05 629

原创 [week 8][Leetcode][Dynamic Programming] Maximum Subarray

Question:  Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [

2017-06-26 15:02:11 267

原创 [week 7][Leetcode][Dynamic Programming]Triangle

Question: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2],

2017-06-26 14:26:01 270

原创 [week 6] [Leetcode] Largest Rectangle in Histogram

Question:  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. Above is a histogram whe

2017-06-25 16:57:11 195

原创 [week 5][Leetcode] Container With Most Water

Question: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and

2017-06-25 16:31:35 296

原创 [week 4][leetcode][array] Trapping Rain Water

Question: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0

2017-06-25 16:19:14 292

原创 [Week 3] [Leetcode] [Array] Remove Duplicates from Sorted Array

Question: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in

2017-06-16 17:23:53 246

原创 [Week 2] [Leetcode][Array] Two Sum

Question:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use t

2017-06-16 17:17:49 234

原创 [Week 1]【Leetcode】Reverse Integer(逆序问题)

1.问题:Reverse digits of an integer example1:x=123,return 321 example2:x=-123,return -321 2.思路:这是一个逆序问题,但是实际还要要来溢出问题。 3.代码: class Solution { public:     int reverse(int x) {         long long tm

2017-02-26 18:20:35 335

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除