- 博客(49)
- 资源 (1)
- 收藏
- 关注
原创 2015年秋季腾讯校园招聘开发岗笔试题二
一直对这道题映像比较深刻: 解题思路如下: 先建立相同的矩阵 A B 9 C D E F G H 最先看到两个式子: A + B - 9 = 4 9 - E - H = 4 所以此处需要两个for,循环,就能得出4个变量; 剩下的4个未知数中,还需要一个for循环就能求出其余的三个数字; 但应该定哪个数为已知的呢?此处应该定D为已知,避免了
2015-09-07 19:37:36 513
原创 TCP/IP网络编程读书笔记-简单的套接字编程(1)
在linux和windows下都是通过套接字编程进行网络编程。不同的系统上通信有部分差别,现在刚开始学习,给自己学习的时候一个总结。
2015-08-30 11:00:21 2073
转载 CentOs下安装Code::Blocks
今天学习linux下面的编程,还是不习惯没有IDE的状态下编程,所以学了这么在linux下安装codeblocks。搜了很多文章,终于找了一篇写的比较详细的文章。这里。中间自己也遇到些问题。原作者有问题的地方,我以红色的备注出来。给大家共同学习。今天下午闲着没事尝试在自己的PC中的CentOS上装一个Code::Blocks,因为是Linux菜鸟折腾了一下午才基本算搞定但依然有
2015-08-27 22:19:17 592
原创 LeetCode-Repeated DNA Sequences
题目链接:https://leetcode.com/problems/repeated-dna-sequences/All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is someti
2015-04-26 20:37:31 489
转载 深入探讨this指针
深入探讨this指针 为了写这篇文章,准备了好长时间,翻遍了箱底的书籍。但是现在还是不敢放开手来写,战战兢兢。不是担心自己写错,而是唯恐自己错误误导别人。同时也希望这篇文章能给你一点收获。既然是深入探讨this指针,所以建议初学者,最好具有一定编译基础,调试基础。如果大家认为这片文章有不满的地方,就给我发信批评一下,以便及时修正。关于this指针的描述我们一般从语言层次上讲;thi
2015-03-16 14:58:46 550
原创 LeetCode_Intersection of Two Linked Lists
题目链接:https://leetcode.com/problems/intersection-of-two-linked-lists/题目:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the followi
2015-03-09 09:11:54 639
原创 LeetCode_Merge Two Sorted Lists
题目链接:https://leetcode.com/problems/merge-two-sorted-lists/题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two
2015-03-09 08:58:57 526
原创 LeetCode-Remove Nth Node From End of List
题目链接:https://leetcode.com/problems/remove-nth-node-from-end-of-list/题目:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1
2015-03-09 08:52:14 587
原创 LeetCode-Minimum Depth of Binary Tree
题目链接:https://oj.leetcode.com/problems/minimum-depth-of-binary-tree/题目:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the ro
2015-02-05 17:05:48 544
原创 LeetCode-Binary Tree Postorder Traversal
题目链接:https://oj.leetcode.com/problems/binary-tree-postorder-traversal/题目:Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3},
2015-02-02 18:25:02 553
原创 LeetCode-Binary Tree Inorder Traversal
题目链接:https://oj.leetcode.com/problems/binary-tree-inorder-traversal/题目:Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3},
2015-02-02 18:22:05 461
原创 Leetcode-Binary Tree Preorder Traversal
题目链接:https://oj.leetcode.com/problems/binary-tree-preorder-traversal/题目:Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3},
2015-02-02 18:18:05 515
原创 LeetCode-Binary Tree Level Order Traversal II
题目链接:https://oj.leetcode.com/problems/binary-tree-level-order-traversal-ii/题目:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, l
2015-01-31 23:29:01 486
原创 LeetCode-Binary Tree Level Order Traversal
题目链接:https://oj.leetcode.com/problems/binary-tree-level-order-traversal/题目:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
2015-01-31 23:18:39 540
原创 LeetCode-Symmetric Tree
题目链接:https://oj.leetcode.com/problems/symmetric-tree/题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is s
2015-01-31 23:12:44 591
原创 LeetCode-Balanced Binary Tree
题目链接:https://oj.leetcode.com/problems/balanced-binary-tree/题目:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary t
2015-01-31 23:03:06 505
原创 LeetCode-Same Treet
题目链接:https://oj.leetcode.com/problems/same-tree/题目:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally i
2015-01-29 23:23:05 556
原创 LeetCode-Sort Colors
题目链接:https://oj.leetcode.com/problems/sort-colors/题目:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the or
2015-01-29 23:20:51 489
原创 LeetCode-Sort Colors
题目链接:https://oj.leetcode.com/problems/sort-colors/题目信息:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the
2015-01-28 23:03:09 505
原创 LeetCode-Spiral Matrix
题目链接:https://oj.leetcode.com/problems/spiral-matrix/题目内容: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 follo
2015-01-21 22:59:08 547
原创 LeetCode-Set Matrix Zeroes
题目链接:https://oj.leetcode.com/problems/set-matrix-zeroes/题目内容:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow u
2015-01-21 22:52:30 490
原创 LeetCode-Maximum Product Subarray
题目链接:点击打开链接题目信息:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray
2015-01-20 21:53:56 758
原创 LeetCode-Unique Paths II
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 is marked as 1 and 0 respectively in the
2015-01-15 21:30:40 541
原创 LeetCode-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 time. The robot is trying to reach the
2015-01-15 21:27:46 570
原创 LeetCode-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 right at
2015-01-14 23:14:37 388
原创 LeetCode-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,−1,2,1] ha
2015-01-13 19:31:33 448
原创 LeetCode-Compare Version Numbers
Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and co
2015-01-11 23:20:24 419
原创 LeetCode-Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.
2015-01-10 21:43:37 390
原创 LeetCode-Find Peak Element
A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in
2015-01-10 21:00:54 415
原创 LeetCode-Search a 2D Matrix
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 from left to right.The first integer of each
2015-01-09 21:03:31 460
原创 LeetCode-Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target valueYour algorithm's runtime complexity must be in the order of O(log n).If the target is not found i
2015-01-08 21:57:49 598
原创 LeetCode-Merge Sorted Array
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements fro
2015-01-07 23:32:45 460
转载 vs2010中MessageBox的用法
虽然孙鑫老师的视频是经典。可是我发现VC++6.0编出来的MFC在2010里就报错了。决定研究一下变化,以适应新的环境首先删除消息框或者什么东西的时候就应该像6.0那样在类视图里删除,而不应该删除代码。有可能有声明的残留。导致编译错误。切记啊。其次,自己手动删除也行,添加一个事件处理,有3个地方要添加代码1.在头文件类的消息处理函数声明中:Class C
2015-01-05 15:04:30 579
原创 Leetcode-Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.解题报告:非常简单的题,相当于进行进位加
2015-01-04 22:29:15 391
原创 LeetCode-Count and Say
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as
2014-12-28 00:35:09 343
原创 LeetCode-Pow(x, n)
Implement pow(x, n).double searcht(double x,int m);double output = 1;class Solution {public: double pow(double x, int n);};//不知道采用迭代算法怎么样double Solution::pow(double x, int n){ int signa
2014-12-25 20:05:13 440
原创 LeetCode-Integer to Roman
class Solution {public: string intToRoman(int num);};string Solution::intToRoman(int num){ string s=""; while(num >= 1000) { num -= 1000; s = s + 'M'; } while(num >= 900) {
2014-12-23 23:21:09 411
原创 LeetCode-Sqrt(x)
Compute and return the square root of x.class Solution {public: int sqrt(int x) ;};int Solution::sqrt(int x){ int i,j; int output=x; int value=x; i=0; j=x; if(x==0) return 0; whil
2014-12-22 23:27:07 374
原创 LeetCode-Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.class Solution {public: int romanToInt(string s) { int num= s.siz
2014-12-16 21:58:34 366
转载 前缀、中缀、后缀表达式
它们都是对表达式的记法,因此也被称为前缀记法、中缀记法和后缀记法。它们之间的区别在于运算符相对与操作数的位置不同:前缀表达式的运算符位于与其相关的操作数之前;中缀和后缀同理。举例:(3 + 4) × 5 - 6 就是中缀表达式- × + 3 4 5 6 前缀表达式3 4 + 5 × 6 - 后缀表达式中缀表达式(中缀记法)中缀表达式是一种通用的算术或逻辑公式表示方法
2014-12-07 12:27:54 458
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人