- 博客(21)
- 资源 (6)
- 收藏
- 关注
转载 01背包问题和完全背包问题
转载网址:http://blog.csdn.net/KangRoger/article/details/38864689在hihocoder上面的题目中看到的这个问题,总结一下。先看01背包问题。01背包问题:一个背包总容量为V,现在有N个物品,第i个 物品体积为weight[i],价值为value[i],现在往背包里面装东西,怎么装能使背包的内物品价值最大?看到这个问
2016-08-31 16:40:07 349
转载 装饰模式与代理模式的区别(转载)
转载网址:http://www.cnblogs.com/jaredlam/archive/2011/11/08/2241089.html学习AOP时,教材上面都说使用的是动态代理,可是在印象中代理模式一直都是控制访问什么的,怎么又动态增加行为了,动态增加行为不是装饰器模式吗?于是 找了很多资料,想弄清楚这两者之间到底有什么区别。结果发现这一篇英文文章讲的很清晰,就翻译一下,供参考。
2016-08-27 22:33:56 346
原创 Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited numb
2016-08-21 22:30:45 193
原创 Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit st
2016-08-19 11:57:16 215
原创 Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())
2016-08-19 10:12:04 172
原创 Move Zeroes
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling you
2016-08-19 09:32:01 150
原创 Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".先将字符串转换成int数组,之后的运算便容易多了public class Solution { public String addBinary(St
2016-08-18 22:29:56 175
转载 Multiply Strings leetcode java
转载网址:http://www.cnblogs.com/springfor/p/3889706.html题目:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large
2016-08-18 19:48:05 198
原创 Excel Sheet Column Number
Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ...
2016-08-18 11:47:45 154
原创 Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB 本题主要是循环提取
2016-08-18 11:34:48 379
原创 Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially fille
2016-08-17 15:53:31 158
原创 Sudoku Solver
Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.A sudoku
2016-08-17 15:01:08 197
转载 回溯法求解N皇后问题(Java实现)
转载地址:http://haolloyin.blog.51cto.com/1177454/353105/回溯法:也称为试探法,它并不考虑问题规模的大小,而是从问题的最明显的最小规模开始逐步求解出可能的答案,并以此慢慢地扩大问题规模,迭代地逼近最终问题的解。这种迭代类似于穷举并且是试探性的,因为当目前的可能答案被测试出不可能可以获得最终解时,则撤销当前的这一步求解过程,回溯到上一步寻找其他求
2016-08-17 10:49:19 2002
原创 Word Search
Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically
2016-08-16 17:04:22 200
原创 Ugly Number
Ugly Number II Total Accepted: 2920 Total Submissions: 15174Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3,
2016-08-16 09:15:18 179
原创 Android中Services之异步IntentService
Android中Services之异步IntentServiceIntentService:异步处理服务,新开一个线程:handlerThread在线程中发消息,然后接受处理完成后,会清理线程,并且关掉服务。IntentService有以下特点:(1) 它创建了一个独立的工作线程来处理所有的通过onStartCommand()传递给服务的intents。(2)
2016-08-13 17:08:25 218
转载 The Skyline Problem
题目:题目太长了,见链接-- > The Skyline Problem Notes:The number of buildings in any input list is guaranteed to be in the range [0, 10000].The input list is already sorted in ascending order by the left
2016-08-10 22:00:07 264
原创 购物单
王强今天很开心,公司发给N元的年终奖。王强决定把年终奖用于购物,他把想买的物品分为两类:主件与附件,附件是从属于某个主件的,下表就是一些主件与附件的例子:主件附件电脑打印机,扫描仪书柜图书书桌台灯,文具工作椅无如果要买归类为附件的物品,必须先买该附件所属的主件。每个主件可以有 0 个、 1 个或 2 个附件。附件不再有从属于自己的附件。王强想买的东西很多,为了不超出预算,他把每件物品规定了一个重要
2016-08-09 18:51:10 459
原创 Kth Smallest Element in a Sorted Matrix
Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that it is the kth smallest element in the sorted order, not
2016-08-09 18:42:46 734
原创 合唱队
计算最少出列多少位同学,使得剩下的同学排成合唱队形说明:N位同学站成一排,音乐老师要请其中的(N-K)位同学出列,使得剩下的K位同学排成合唱队形。 合唱队形是指这样的一种队形:设K位同学从左到右依次编号为1,2…,K,他们的身高分别为T1,T2,…,TK, 则他们的身高满足存在i(1Ti+1>......>TK。 你的任务是,已知所有N位同学的身高,计算最少需要几位同学出列,可以
2016-08-06 10:23:44 194
原创 微软实习笔试题
You work as an intern at a robotics startup. Today is your company's demo day. During the demo your company's robot will be put in a maze and without any information about the maze, it should be abl
2016-08-04 16:40:32 471
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人