上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 44 下一页
摘要: Download VTK 6.3.0Download Qt 5.4 with MinGW 4.9.1Download CMake 3.2.0I assume you've already installed Qt 5.4 with MinGW 4.9.1 and CMake 3.2.0 correc... 阅读全文
posted @ 2015-10-16 07:27 Grandyang 阅读(1982) 评论(0) 推荐(0) 编辑
摘要: 11.2 Write a method to sort an array of strings so that all the anagrams are next to each other.这道题让我们给一个字符串数组排序,让所有的变位词Anagrams排在一起,关于变位词,LeetCode里有两... 阅读全文
posted @ 2015-10-15 12:13 Grandyang 阅读(756) 评论(0) 推荐(0) 编辑
摘要: 11.1 You are given two sorted arrays, A and B, where A has a large enough buffer at the end to hold B. Write a method to merge B into A in sorted orde... 阅读全文
posted @ 2015-10-14 23:22 Grandyang 阅读(826) 评论(0) 推荐(0) 编辑
摘要: Matlab中,我们有时候要删除矩阵中的某行某列,可以采用下列方法进行删除:a = [1 2 34 5 67 8 9];a(2,:) = []; % Delete row 2a(:,2) = []; % Delete col 2 阅读全文
posted @ 2015-10-14 04:33 Grandyang 阅读(2374) 评论(0) 推荐(0) 编辑
摘要: 10.7 Imagine a web server for a simplified search engine. This system has 100 machines to respond to search queries, which may then call out using pro... 阅读全文
posted @ 2015-10-13 12:28 Grandyang 阅读(828) 评论(0) 推荐(0) 编辑
摘要: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2015-10-12 23:22 Grandyang 阅读(11912) 评论(0) 推荐(0) 编辑
摘要: 使用C++的unordered_map类型时,我们经常要根据关键字查找,并移除一组映射,在Java中直接用remove即可,而STL中居然没有实现remove这个函数,还要自己写循环来查找要删除项,然后用erase来清除,我也是醉了,参见下面代码:vector v1;// remove A *a1f... 阅读全文
posted @ 2015-10-12 12:40 Grandyang 阅读(6061) 评论(0) 推荐(0) 编辑
摘要: Implement a trie with insert, search, and startsWith methods.Have you met this question in a real interview?ExampleNoteYou may assume that all inputs ... 阅读全文
posted @ 2015-10-11 10:45 Grandyang 阅读(1604) 评论(0) 推荐(0) 编辑
摘要: 10.6 You have 10 billion URLs. How do you detect the duplicate documents? In this case, assume that "duplicate" means that the URLs are identical.这道题让... 阅读全文
posted @ 2015-10-10 06:30 Grandyang 阅读(866) 评论(0) 推荐(0) 编辑
摘要: 1. Accelerated 35. Empowered 69. Motivated 2. Accomplished 36. Enabled 70. Negotiated 3. Achieved 37. Encouraged 71. Obtained 4. Acted 38. Engineered 阅读全文
posted @ 2015-10-09 04:13 Grandyang 阅读(1547) 评论(0) 推荐(0) 编辑
摘要: 10.5 If you were designing a web crawler, how would you avoid getting into infinite loops?这道题问如果让我们设计一个网络爬虫,怎么样才能避免进入无限循环。那么何谓无限循环呢,如果我们将网络看做一个图Graph,... 阅读全文
posted @ 2015-10-08 22:51 Grandyang 阅读(1348) 评论(0) 推荐(0) 编辑
摘要: 10.4 You have an array with all the numbers from 1 to N, where N is at most 32,000. The array may have duplicate entries and you do not know what N is... 阅读全文
posted @ 2015-10-08 11:23 Grandyang 阅读(739) 评论(0) 推荐(0) 编辑
摘要: 在C++中,我们有时候需要拆分字符串,比如字符串string str = "dog cat cat dog"想以空格区分拆成四个单词,Java中实在太方便了,直接String[] v = str.split(" ");就搞定了,而c++中没有这么方便的实现,但也有很多的方法能实现这个功能,下面列出五... 阅读全文
posted @ 2015-10-07 13:04 Grandyang 阅读(9236) 评论(0) 推荐(0) 编辑
摘要: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a lette 阅读全文
posted @ 2015-10-06 13:21 Grandyang 阅读(15617) 评论(10) 推荐(0) 编辑
摘要: 10.3 Given an input file with four billion non-negative integers, provide an algorithm to generate an integer which is not contained in the file. Assu... 阅读全文
posted @ 2015-10-05 13:34 Grandyang 阅读(734) 评论(0) 推荐(0) 编辑
摘要: According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John 阅读全文
posted @ 2015-10-04 13:20 Grandyang 阅读(31106) 评论(8) 推荐(6) 编辑
摘要: 10.2 How would you design the data structures for a very large social network like Facebook or Linkedln? Describe how you would design an algorithm to... 阅读全文
posted @ 2015-10-03 12:27 Grandyang 阅读(847) 评论(0) 推荐(0) 编辑
摘要: 10.1 Imagine you are building some sort of service that will be called by up to 1000 client applications to get simple end-of-day stock price informat... 阅读全文
posted @ 2015-10-02 06:37 Grandyang 阅读(599) 评论(0) 推荐(0) 编辑
摘要: 9.11 Given a boolean expression consisting of the symbols 0,1, &, |, and ^, and a desired boolean result value result, implement a function to count t... 阅读全文
posted @ 2015-10-01 14:11 Grandyang 阅读(676) 评论(0) 推荐(0) 编辑
摘要: 9.10 You have a stack of n boxes, with widths w., heights hir and depths drThe boxes cannot be rotated and can only be stacked on top of one another i... 阅读全文
posted @ 2015-09-30 00:59 Grandyang 阅读(1228) 评论(0) 推荐(0) 编辑
摘要: 在C++编程中,有时候要求我们把数据保留小数点后几位,或是保留多少位有效数字等等,那么就要用到setiosflags和setprecision函数,记得要包含头文件#include ,请参考下面的示例:#include #include // Need this using namespac... 阅读全文
posted @ 2015-09-29 12:18 Grandyang 阅读(993) 评论(0) 推荐(0) 编辑
摘要: 9.9 Write an algorithm to print all ways of arranging eight queens on an 8x8 chess board so that none of them share the same row, column or diagonal. ... 阅读全文
posted @ 2015-09-29 11:17 Grandyang 阅读(932) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nu 阅读全文
posted @ 2015-09-28 11:37 Grandyang 阅读(46823) 评论(19) 推荐(4) 编辑
摘要: C++的STL中提供了很强大的排序函数sort,可以对任意数组,结构体及类进行排序,下面我们先来看最简单的数组排序。默认的升序排列,我们也可以在后面加上less或greater来告诉编译器我们想要的排序顺序。 vector<int> v = {2, 0, 1, 5, 9, 2, 7}; // Asc 阅读全文
posted @ 2015-09-28 10:56 Grandyang 阅读(24504) 评论(6) 推荐(1) 编辑
摘要: DescriptionIn the city, there is a one-way straight highway starts from the northern end, traverses the whole city southward, and finishes at the sout... 阅读全文
posted @ 2015-09-27 14:40 Grandyang 阅读(653) 评论(0) 推荐(0) 编辑
摘要: 9.8 Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent), write code to calculate the number of w... 阅读全文
posted @ 2015-09-26 14:08 Grandyang 阅读(4813) 评论(0) 推荐(0) 编辑
摘要: Cosine similarity is a measure of similarity between two vectors of an inner product space that measures the cosine of the angle between them. The cos... 阅读全文
posted @ 2015-09-25 12:47 Grandyang 阅读(2643) 评论(0) 推荐(0) 编辑
摘要: 在写paper的时候,我们常常要给公式编号,难道我们要在公式和最右边的序号之间疯狂按空格键吗,当然不是,我们可以有更高效的方法来完成。首先我们插入一个1x3的表格,然后调节首尾两个格子的大小,借助标尺(可以在视图栏View中开启)将其调小到合适位置然后我们在尾部的格子中先填入括号(),然后指针放到中... 阅读全文
posted @ 2015-09-24 01:20 Grandyang 阅读(5529) 评论(0) 推荐(0) 编辑
摘要: 9.7 Implement the "paint fill" function that one might see on many image editing programs. That is, given a screen (represented by a two-dimensional a... 阅读全文
posted @ 2015-09-23 11:34 Grandyang 阅读(1250) 评论(0) 推荐(0) 编辑
摘要: Template:1.A. Author Surname, 'Title', Year Published, (accessed 10 October 2013).Example:1.I. Heap, 'the Gloves', Imogenheap.co.uk, 2012, (access... 阅读全文
posted @ 2015-09-23 03:44 Grandyang 阅读(5101) 评论(0) 推荐(0) 编辑
摘要: 9.6 Implement an algorithm to print all valid (e.g., properly opened and closed) combinations of n-pairs of parentheses.EXAMPLEInput: 3Output: ((())),... 阅读全文
posted @ 2015-09-22 12:47 Grandyang 阅读(772) 评论(0) 推荐(0) 编辑
摘要: Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it e 阅读全文
posted @ 2015-09-21 01:52 Grandyang 阅读(11025) 评论(3) 推荐(1) 编辑
摘要: 9.5 Write a method to compute all permutations of a string.LeetCode上的原题,请参加我之前的博客Permutations 全排列和Permutations II 全排列之二。解法一:class Solution {public: ... 阅读全文
posted @ 2015-09-20 09:12 Grandyang 阅读(629) 评论(0) 推荐(0) 编辑
摘要: 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, giv 阅读全文
posted @ 2015-09-20 01:02 Grandyang 阅读(18812) 评论(0) 推荐(1) 编辑
摘要: 9.4 Write a method to return all subsets of a set.LeetCode上的原题,请参见我之前的博客Subsets 子集合和Subsets II 子集合之二。解法一:class Solution {public: vector > getSubset... 阅读全文
posted @ 2015-09-19 04:05 Grandyang 阅读(619) 评论(0) 推荐(0) 编辑
摘要: 9.3 A magic index in an array A[0.. .n-1] is defined to be an index such that A[i] = i. Given a sorted array of distinct integers, write a method to f... 阅读全文
posted @ 2015-09-18 10:58 Grandyang 阅读(1041) 评论(0) 推荐(0) 编辑
摘要: 9.2 Imagine a robot sitting on the upper left corner of an X by Y grid. The robot can only move in two directions: right and down. How many possible p... 阅读全文
posted @ 2015-09-17 23:22 Grandyang 阅读(979) 评论(0) 推荐(0) 编辑
摘要: 9.1 A child is running up a staircase with n steps, and can hop either 1 step, 2 steps, or 3 steps at a time. Implement a method to count how many pos... 阅读全文
posted @ 2015-09-17 03:08 Grandyang 阅读(1057) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2015-09-17 00:36 Grandyang 阅读(16) 评论(0) 推荐(0) 编辑
摘要: Given a string that contains only digits 0-9 and a target value, return all possibilities to add binaryoperators (not unary) +, -, or * between the di 阅读全文
posted @ 2015-09-16 21:01 Grandyang 阅读(20035) 评论(6) 推荐(2) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 44 下一页
Fork me on GitHub