04 2017 档案

摘要:题目大意 意思就是这里有n个小朋友要选一个班长。 每一个小朋友都有一票,小朋友因为害羞不会投自己,只会投给他们最好的同学。现在1号小朋友想要当班长,而且是当唯一的班长,这就意味着他的票数必须要大于其他人的所有票。他可以通过买糖果给其他小朋友让他们把票投给他自己。 现在求1号当上班长需要花费的最小糖果 阅读全文
posted @ 2017-04-29 23:31 aiterator 阅读(238) 评论(0) 推荐(0) 编辑
摘要:A string is called bad if it has 3 vowels in a row, or 5 consonants in a row, or both. A string is called good if it is not bad. You are given a strin 阅读全文
posted @ 2017-04-29 18:39 aiterator 阅读(346) 评论(0) 推荐(0) 编辑
摘要:Your friend Jim has challenged you to a game. He has a bag containing red and blue marbles. There will be an odd number of marbles in the bag, and you 阅读全文
posted @ 2017-04-21 16:23 aiterator 阅读(147) 评论(0) 推荐(0) 编辑
摘要:Nowadays the one way traffic is introduced all over the world in order to improve driving safety and reduce traffic jams. The government of Dhaka Divi 阅读全文
posted @ 2017-04-19 15:55 aiterator 阅读(364) 评论(0) 推荐(0) 编辑
摘要:This winter we are going on a trip to Bandorban. The main target is to climb up to the top of Keokradong. So, we will use a trail. The trail is a cont 阅读全文
posted @ 2017-04-18 22:23 aiterator 阅读(274) 评论(0) 推荐(0) 编辑
摘要:A rider is a fantasy chess piece that can jump like a knight several times in a single move. A rider that can perform a maximum of K jumps during a si 阅读全文
posted @ 2017-04-18 21:06 aiterator 阅读(195) 评论(0) 推荐(0) 编辑
摘要:A palindrome partition is the partitioning of a string such that each separate substring is a palindrome. For example, the string "ABACABA" could be p 阅读全文
posted @ 2017-04-17 20:33 aiterator 阅读(200) 评论(0) 推荐(0) 编辑
摘要:Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For example, Given sorted array nums = , Your function should return 阅读全文
posted @ 2017-04-17 11:40 aiterator 阅读(94) 评论(0) 推荐(0) 编辑
摘要: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 "adjac 阅读全文
posted @ 2017-04-16 23:06 aiterator 阅读(110) 评论(0) 推荐(0) 编辑
摘要:Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = 阅读全文
posted @ 2017-04-14 21:07 aiterator 阅读(89) 评论(0) 推荐(0) 编辑
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, If n = 4 and k = 2, a solution is: [ [2,4], [3, 阅读全文
posted @ 2017-04-14 20:57 aiterator 阅读(95) 评论(0) 推荐(0) 编辑
摘要:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example, S = "ADOBECO 阅读全文
posted @ 2017-04-14 20:41 aiterator 阅读(106) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-04-14 19:35 aiterator 阅读(86) 评论(0) 推荐(0) 编辑
摘要:Given a matrix, if an element is 0, set its entire row and column to 0. Do it in place. 题目大意就是将矩阵中等于0的点所在的行和列中的元素全部置为0; 并且要求不得声明额外的数组空间。 既然不得在额外的数组空间中 阅读全文
posted @ 2017-04-13 19:36 aiterator 阅读(99) 评论(0) 推荐(0) 编辑
摘要:See the picture below. You are given , and . is parallel to . You are also given the area ratio between and . You have to find the value of . 水题; 说一下题 阅读全文
posted @ 2017-04-12 21:44 aiterator 阅读(113) 评论(0) 推荐(0) 编辑
摘要:This is the tale of Zephyr, the greatest time traveler the world will never know. Even those who are aware of Zephyr's existence know very little abou 阅读全文
posted @ 2017-04-12 21:03 aiterator 阅读(235) 评论(0) 推荐(0) 编辑
摘要:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have 阅读全文
posted @ 2017-04-12 20:13 aiterator 阅读(83) 评论(0) 推荐(0) 编辑
摘要:Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You shou 阅读全文
posted @ 2017-04-12 13:38 aiterator 阅读(148) 评论(0) 推荐(0) 编辑
摘要:Validate if a given string is numeric. Some examples: "0" = true " 0.1 " = true "abc" = false "1 a" = false "2e10" = true Note : It is intended for th 阅读全文
posted @ 2017-04-11 20:42 aiterator 阅读(157) 评论(0) 推荐(0) 编辑
摘要: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. 阅读全文
posted @ 2017-04-10 13:56 aiterator 阅读(87) 评论(0) 推荐(0) 编辑
摘要:Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space 阅读全文
posted @ 2017-04-10 13:44 aiterator 阅读(100) 评论(0) 推荐(0) 编辑
摘要: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 p 阅读全文
posted @ 2017-04-10 13:41 aiterator 阅读(103) 评论(0) 推荐(0) 编辑
摘要:Given a set of digits S, and an integer n, you have to find how many n digit integers are there, which contain digits that belong to S and the differe 阅读全文
posted @ 2017-04-09 19:21 aiterator 阅读(272) 评论(0) 推荐(0) 编辑
摘要:描述 在8x8的国际象棋棋盘上给定一只骑士(俗称“马”)棋子的位置(R, C),小Hi想知道从(R, C)开始移动N步一共有多少种不同的走法。 输入 第一行包含三个整数,N,R和C。 对于40%的数据, C++ include using namespace std; typedef vector 阅读全文
posted @ 2017-04-09 19:12 aiterator 阅读(584) 评论(0) 推荐(0) 编辑
摘要:描述 小Hi写程序时习惯用蛇形命名法( )为变量起名字,即用下划线将单词连接起来,例如: 、 。 小Ho写程序时习惯用驼峰命名法(camel case)为变量起名字,即第一个单词首字母小写,后面单词首字母大写,例如:fileName、lineNumber。 为了风格统一,他们决定邀请公正的第三方来编 阅读全文
posted @ 2017-04-09 15:34 aiterator 阅读(288) 评论(0) 推荐(0) 编辑
摘要:描述 给定一个NxM的矩阵A和一个整数K,小Hi希望你能求出其中最大(元素数目最多)的子矩阵,并且该子矩阵中所有元素的和不超过K。 输入 第一行包含三个整数N、M和K。 以下N行每行包含M个整数,表示A。 对于40%的数据, 1 using namespace std; int main() { i 阅读全文
posted @ 2017-04-09 15:22 aiterator 阅读(182) 评论(0) 推荐(0) 编辑
摘要:3.5.1 TCP连接 + tcp 是因特网运输层的面向连接的可靠的运输协议。 + tcp 只工作在两个端系统中,不在中间的网络元素(路由器和交换机)中运行。即中间路由器完全看不见tcp连接,它们看到的只有数据报。 + tcp 是全双工的工作状态,即两个端系统A,B一旦建立tcp连接,端系统A向端系 阅读全文
posted @ 2017-04-09 10:41 aiterator 阅读(204) 评论(0) 推荐(0) 编辑
摘要:Given a list, rotate the list to the right by k places, where k is non negative. For example: Given and , return . 题目意思就是将链表后面k个数,放到链表前面。 那么只需要一次循环就可以 阅读全文
posted @ 2017-04-08 23:16 aiterator 阅读(158) 评论(0) 推荐(0) 编辑
摘要:The set contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following sequence (ie, for n 阅读全文
posted @ 2017-04-06 21:00 aiterator 阅读(89) 评论(0) 推荐(0) 编辑
摘要:作用: + 1.知道一个序列的所有成员,可以很快得到这个序列的第k大序列(按字典序排序) + 2.给定一个序列,很快可以算出所给序列的大小(按字典序排序),常用于状态压缩 将含有n个元素的序列转换成一个数字(字典序大小) 公式 。 对于 ,代表当前元素在所有元素中是第 大的数字。(下标从 开始) 例 阅读全文
posted @ 2017-04-06 20:58 aiterator 阅读(168) 评论(0) 推荐(0) 编辑
摘要:Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = , You should return the followi 阅读全文
posted @ 2017-04-06 17:09 aiterator 阅读(103) 评论(0) 推荐(0) 编辑
摘要:Given a set of non overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文
posted @ 2017-04-06 16:45 aiterator 阅读(100) 评论(0) 推荐(0) 编辑
摘要:描述 一只木桶能盛多少水,并不取决于桶壁上最高的那块木板,而恰恰取决于桶壁上最短的那块。 已知一个木桶的桶壁由N块木板组成,第i块木板的长度为Ai。 现在小Hi有一个快捷修补工具,每次可以使用修补工具将连续的不超过L块木板提高至任意高度。 已知修补工具一共可以使用M次(M L using names 阅读全文
posted @ 2017-04-06 15:20 aiterator 阅读(295) 评论(0) 推荐(0) 编辑
摘要:Given a collection of intervals, merge all overlapping intervals. For example, Given , , , , return , , . + 按开始位置大小排序 + 循环数组;如果当前区间的开始位置大于上一个区间的结束位置,将 阅读全文
posted @ 2017-04-06 13:37 aiterator 阅读(84) 评论(0) 推荐(0) 编辑
摘要:A 整除的尾数 + 枚举一下后两位数。 代码: C++ include using namespace std; int main() { int x, y, w, n; while(scanf("%d%d%d%d", &x, &y, &w, &n) != EOF) { int res = x / 阅读全文
posted @ 2017-04-05 21:02 aiterator 阅读(232) 评论(0) 推荐(0) 编辑
摘要: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 maxim 阅读全文
posted @ 2017-04-05 11:50 aiterator 阅读(96) 评论(0) 推荐(0) 编辑
摘要:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 阅读全文
posted @ 2017-04-05 11:35 aiterator 阅读(93) 评论(0) 推荐(0) 编辑
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array , the contiguous 阅读全文
posted @ 2017-04-04 21:31 aiterator 阅读(76) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2017-04-04 21:25 aiterator 阅读(92) 评论(0) 推荐(0) 编辑
摘要:Follow up for N Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. 上一题,稍微修改一下就可以了。 C++ class 阅读全文
posted @ 2017-04-04 21:25 aiterator 阅读(100) 评论(0) 推荐(0) 编辑
摘要:Implement pow(x, n). 水题 直接 就可以过了。 用快速幂比较好一点。 阅读全文
posted @ 2017-04-01 12:45 aiterator 阅读(112) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示