2014年11月4日
摘要: 今天觉得codeblock看着刺眼,想了想,能不能跟vs利用dark背景一样可以设置一个舒服的背景。于是就开始各种点击,各种摸索了。1. 背景和各种颜色设置不妨先说下vs中的设置是:工具(Tools) -- 选项(Options) -- 环境(Environment) -- 常规(General) ... 阅读全文
posted @ 2014-11-04 17:31 higerzhang 阅读(25740) 评论(0) 推荐(1) 编辑
摘要: 题目:给定一连串的区间,要求输出不重叠的区间。Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10]... 阅读全文
posted @ 2014-11-04 01:01 higerzhang 阅读(212) 评论(0) 推荐(0) 编辑
  2014年11月3日
摘要: 这题和那题类似,这题更简单。我当初就做了这题。当初的代码如下:class Solution {public: bool canJump(int A[], int n) { if (n canReach) return false; ... 阅读全文
posted @ 2014-11-03 00:18 higerzhang 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 题目:螺旋输出数组(听师兄说是今年google电话面试题)Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the fo... 阅读全文
posted @ 2014-11-03 00:08 higerzhang 阅读(306) 评论(0) 推荐(0) 编辑
  2014年11月2日
摘要: 题目: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... 阅读全文
posted @ 2014-11-02 01:08 higerzhang 阅读(185) 评论(0) 推荐(0) 编辑
  2014年11月1日
摘要: 题目和上一题一样,就是要求输出有多少种结果。最直接的就是,只要在上一题的代码return ans.size();就可以了。果然也是AC了。然后我翻看了几种别人写的,暂时还没有找到复杂度可以比上一题降低多少的。可以加一个全局变量。以前都没有想到给solution类加全局变量。满足条件的时候全局变量加一... 阅读全文
posted @ 2014-11-01 00:02 higerzhang 阅读(190) 评论(0) 推荐(0) 编辑
  2014年10月31日
摘要: 题目:给定一个n,那么在n*n的棋盘里面放国际象棋的皇后,皇后之间互不在攻击范围。(皇后的攻击范围是她所在位置的哪一行,那一列,和她的正负1的对角线)Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such... 阅读全文
posted @ 2014-10-31 23:25 higerzhang 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 题目:就是实现一个指数函数。直接用一个while一直乘以n词肯定是会超时的。自己写了用递归(而且是很挫的递归),测试了无数次,根据每个case去修改代码。终于可以AC了。不忍直视,自己写了好长,如下:class Solution {public: double pow(double x, in... 阅读全文
posted @ 2014-10-31 00:00 higerzhang 阅读(345) 评论(0) 推荐(0) 编辑
  2014年10月30日
摘要: 题目:给定一个vector,然后里面有若干个字符串的长度和组成的字母是相同的,找出这些字符串记录并返回。顾名思义,也就是抛弃单一的字符串,单一是指没有和它长度相同并且组成的字母也相同的另一个字符串。原题如下:Given an array of strings, return all groups o... 阅读全文
posted @ 2014-10-30 21:17 higerzhang 阅读(216) 评论(1) 推荐(0) 编辑
摘要: 题目:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?在原址上进行将矩阵旋转90度。如... 阅读全文
posted @ 2014-10-30 17:24 higerzhang 阅读(184) 评论(0) 推荐(0) 编辑