自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Netty处理请求过程

【代码】Netty处理请求过程。

2023-06-27 12:01:43 84

原创 开心的小明-动态规划算法

开心的小明时间限制:1000 ms  |  内存限制:65535 KB难度:4描述小明今天很开心,家里购置的新房就要领钥匙了,新房里有一间他自己专用的很宽敞的房间。更让他高兴的是,妈妈昨天对他说:“你的房间需要购买哪些物品,怎么布置,你说了算,只要不超过N 元钱就行”。今天一早小明就开始做预算,但是他想买的东西太多了,肯定会超过妈妈限定的N 元。于是,他把每件物品规

2017-08-12 21:36:57 2073

原创 Leetcode-53. Maximum Subarray

题目: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 [4,-

2017-01-18 12:12:49 638

原创 Leetcode-139. Word Break

题目:Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. Y

2017-01-13 14:28:53 517

原创 Leetcode-95.Unique Binary Search Trees II(a representative recursion problem)

题目:Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown bel

2017-01-11 22:07:53 534

原创 Leetcode-96.Unique Binary Search Trees

题目:Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2

2017-01-10 22:44:05 515

原创 Leetcode-91. Decode Ways

Leetcode-91.Decode Ways题目:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message contain

2017-01-05 12:00:13 507

原创 Leetcode-62. Unique Paths and 63. Unique Paths II

Leetcode-62. Unique Paths题目: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 tim

2017-01-04 22:02:58 405

原创 Leetcode-64. Minimum Path Sum

题目: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 down or

2017-01-04 20:41:18 420

原创 464. Can I Win(something needed to be solved!)

写博客之前还是贴一下广州的天气:生活在广州的同学们傻傻分不清楚是冬天还是夏天。。。。。。下面我们进入正题:题目:In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the ru

2017-01-04 15:03:59 728

原创 Leetcode-70. Climbing Stairs

好久没有刷题了,感觉手都生了。今天来道简单点的题目——爬楼梯;题目如下: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

2017-01-02 11:01:55 491

原创 Leetcode-467. Unique Substrings in Wraparound String

题目:Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".

2016-12-07 22:13:43 1761

原创 Leetcode-446. Arithmetic Slices II - Subsequence

题目:A sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For example, these are arithmet

2016-12-06 20:52:36 1262

原创 Leetcode-198. House Robber,213. House Robber II

题目:

2016-11-15 22:15:59 422

原创 Leetcode-403.Frog Jump(青蛙跳石头)

今天的题目是:Leetcode 403-青蛙跳A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into

2016-11-15 20:05:31 4230

原创 Leetcode-32. Longest Valid Parentheses

题目:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses subs

2016-11-13 22:37:30 447

原创 Leetcode-264. Ugly Number II

题目:代码:版本1:class Solution1 {public: int nthUglyNumber(int n) { vectornum = {2,3,5}; vectorre; re.push_back(0); //少于6个数 for (int i = 0; i < 6; i++)re.push_back(1); if (n <= 6

2016-11-12 14:59:52 412

原创 Leetcode-279. Perfect Squares

今天广州天气有点冷,如下图:so,刷个题暖暖身吧!!看题:279. Perfect Squares QuestionEditorial Solution My SubmissionsTotal Accepted: 56296Total Submissions: 163333Difficulty: MediumCon

2016-11-10 16:40:39 630

原创 Leetcode-312. Burst Balloons

题目:312. Burst Balloons Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If t

2016-11-09 22:36:27 481

原创 双重二分查找的应用

前几天面试的时候遇到一个问题,给定n个ip地址和m个ip地址块,如何判断,这n个地址是否在这m个ip地址块中的任意一个中。后来想到了一个双重二分查找的方法,思路如下:以IPv4地址为例,一共32位,为了方便记忆采用点分10进制方法标识。其本质是32位无符号整形,每一位不是0就是1,这样用来标记2^32-1个不同的unsigned型整数,每一个数代表一个网络地址。所以,对于一个给定的

2016-11-06 20:39:16 852

原创 Leetcode-321. Create Maximum Number

题目:

2016-11-06 20:31:52 590

原创 Leetcode-322.Coin Change

题目:You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of m

2016-10-29 22:21:54 457

原创 Leetcode-354. Russian Doll Envelopes

题目:You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the width and height of one envelope is greater th

2016-10-29 11:34:59 413

原创 leetcode-357. Count Numbers with Unique Digits

Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x Example:Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x 题目的意思就是每一位上

2016-10-29 09:11:34 372

原创 eBay校园招聘编程题-淘气的小明

题目:

2016-10-27 22:39:53 553

原创 Leetcode-368. Largest Divisible Subset

题目:Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0.If there are multiple solut

2016-10-24 12:56:35 282

原创 leetcode-363. Max Sum of Rectangle No Larger Than K

题目:Given a non-empty 2D matrix matrix and an integer k, find the max sum of a rectangle in the matrix such that its sum is no larger than k.Example:Given matrix = [  [1,  0, 1],  [0, -2, 3

2016-10-23 15:13:31 557

原创 leetcode-376. Wiggle Subsequence

题目:链接:https://leetcode.com/problems/wiggle-subsequence/A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negat

2016-10-22 21:57:53 281

原创 leetcode-377. Combination Sum IV

Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1, 2, 3]target = 4Th

2016-10-22 20:03:29 256

原创 leetcode-410. Split Array Largest Sum

题目:Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest sum among th

2016-10-22 11:58:41 1705

原创 牛客网-二叉搜索树转换成一个排序的双向链表

题目描述输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向.第一种方法:class Solution {public: void buildseq(TreeNode* pRootOfTree) { if (pRootOfTree != NULL){ //各元素依次入栈 buildseq(pRoot

2016-10-19 18:22:07 534

原创 Leetcode-413. Arithmetic Slices

A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For example, these are arithmetic sequenc

2016-10-19 11:29:44 571

原创 Leetcode-416. Partition Equal Subset Sum(01背包拓展)

01背包问题定义:给定n种物品和一背包。物品i的重量是wi,其价值是vi,背包的容量是c.问如何选择装入背包中的物品,使得装入背包中的物品的总价值最大?

2016-10-18 23:45:53 844

原创 牛客网-救援队

题目: 时间限制:C/C++语言 1000MS;其他语言 3000MS内存限制:C/C++语言 65536KB;其他语言 589824KB题目描述:小A是一个城市中救援机构的负责人,他手头上有一张特殊的地图,记载了本省各个城市中救援队伍的数量和城市之间的道路连接情况。他的任务相当重要,除负责本市紧急情况救援外,他还需要在某个其他城市发生紧急情况时,第一时间带领他的队伍参与救援,

2016-10-15 21:12:46 843

原创 设计模式-原型模式

用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象。这个其实和C++的拷贝构造函数的作用是一致的,实际上就是动态抽取当前对象运行时的状态。通过已有对象的clone方法可以克隆一个当前对象,但是涉及到一些资源时(比如指针所指向的内存)不进行共享,换句话说就是深拷贝;如此说来,用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象。其中有一个词很重要,那就是拷贝。可以说,拷

2016-10-14 17:33:13 262

原创 LeetCode-通配符模式串匹配

给定一个

2016-10-13 20:14:21 2175

原创 欢聚时代(YY)面试

欢聚时代在广州的总部还是有点偏的,但是好在有专车接送,就方便多了。费话不多说,直接上题,下面是个人当时回答得不完整或是没回答上来的问题!!!问题1:#program pack(n)的作用在搞清楚这个问题之前先看看在vs2013环境下占用的字节大小:int main(){ cout << "long float:"<<sizeof(long float) << endl; cout

2016-10-09 21:35:28 4907 1

原创 c++备忘录2

1.操作符重载,总结一下,个人觉得只有三种情况:情形a: 在类内部重载操作符class base{public: base(int x){ a = x; } base & operator+(base &obj1); void get_number(){ cout << a << endl; }private: int a;};base & base::ope

2016-10-06 18:26:55 383

原创 牛客网-并查集(交换位置)

题目:经过深思熟虑之后,小贱君打算去M国闯一闯,那是一个古老的东方国度,传说有很多高阶魔法师,他想成为一名伟大的魔法师,将来征服星辰大海。经过千辛万苦,小贱君终于来到了M国,不幸的是刚进城门小贱君就被M国的守城士兵困在了一种叫做“困兽之斗”的阵法之中。士兵对小贱君说:“看到漂浮在你身边的宝石了吗?彩虹连接的两颗宝石可以任意交换位置,你需要通过一系列交换后使得宝石组成的字符串的字典序最小

2016-10-05 20:21:31 500

原创 牛客网-最长递增子序列

/*最长递增子序列A给定一个长度为N的数组,找出一个最长的单调自增子序列(不一定连续,但是顺序不能乱)例如:给定一个长度为8的数组A{1,3,5,2,4,6,7,8},则其最长的单调递增子序列为{1,2,4,6,7,8},长度为6.输入描述:第一行包含一个整数T,代表测试数据组数。对于每组测试数据:N-数组的长度a1 a2 ... an (需要计算的数组)保证:1<

2016-10-05 19:24:38 726

空空如也

空空如也

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

TA关注的人

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