- 博客(24)
- 收藏
- 关注
原创 关于函数(二)数组指针和指针数组
参考http://blog.csdn.net/touch_2011/article/details/69669801、概述指针数组:指针数组可以说成是”指针的数组”,首先这个变量是一个数组,其次,”指针”修饰这个数组,意思是说这个数组的所有元素都是指针类型,在32位系统中,指针占四个字节。数组指针:数组指针可以说成是”数组的指针”,首先这个变量是一个指针,其次,”数组”修饰这个指针,意思是说这个
2017-07-19 01:42:56 659 1
原创 LeetCode#22* 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: [ “((()))”, “(()())”, “(())()”,
2017-07-18 11:45:10 464
原创 关于函数(一)const与函数
一.const与函数1、概述 在普通的非 const成员函数中,this的类型是一个指向类类型的 const指针。可以改变this所指向的值,但不能改变 this所保存的地址。在 const成员函数中,this的类型是一个指向 const类类型对象的 const指针。既不能改变 this所指向的对象,也不能改变 this所保存的地址。 看到const关键字,C++程序
2017-07-18 11:43:04 1266
原创 LeetCode#21 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 lists.题意:就是给你两个已经排好序的链表,然后叫你合并成一个链表。 思路:就是考链表的操作。代码:/** * Defin
2017-07-17 20:52:02 431
原创 LeetCode#20 Valid Parentheses
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but “
2017-07-17 20:47:54 386
原创 LeetCode#15* 3Sum && LeetCode#16 3Sum Closest && LeetCode#18 4Sum
【3Sum】 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contai
2017-07-17 20:37:18 541
原创 LeetCode#17 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 string “23
2017-07-17 20:36:53 521
原创 LeetCode#19 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->2->3->4->5, and n = 2. After removing the second node from the end, the link
2017-07-17 20:36:22 360
原创 LeetCode#14 Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.题意:写一个函数(或方法)来寻找一个字符串数组中的最长公共前缀。 例如:”abcdefg” ”abcdefghijk” ”abcdfghijk” ”abcef
2017-07-17 10:48:01 342
原创 LeetCode#12 Integer to Roman && #13* Roman to Integer(罗马数字转换)
12题: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.13题: Given a roman numeral, convert it to an integer. Input is guaranteed to b
2017-07-17 10:34:18 407
原创 LeetCode#11 Container With Most Water
Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lin
2017-07-17 09:59:33 483
原创 LeetCode#9* Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer to string,
2017-07-17 02:43:12 393
原创 LeetCode#8 String to Integer (atoi)
Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input case
2017-07-17 02:20:35 359
原创 指针和const
一.定义 一般,说到指针和const,就分两种:const指针和指向const的指针。const指针是指针变量的值一经初始化,就不可以改变指向,初始化是必要的;而指向const的指针是说指针指向的变量是const的(其实这种说法也是不太准确的,和const引用有点像)可以这样理解:一种指的是你不能修改指针本身的内容,另一种指的是你不能修改指针指向的内容(只是说不能通过指针的方式去修改,如
2017-07-16 21:13:53 535
原创 关于const引用
一.定义 简单地说,const引用是指–指向const的引用(其实这样说不恰当,在我的理解中,const引用中的const只是限定了不能通过此引用去修改变量的值),和const指针一样,const引用可以与常量绑定,也可以与变量绑定,只是不能通过这个const引用来改变绑定对象的值,就如之后要讲的const指针类似。 另外,引用的对象是常量还是非常量可以决定其能参与的操作
2017-07-16 01:12:42 1348
原创 网络层(三)IP协议
IP协议用于将多个包交换网络连接起来,它在源地址和目的地址之间传送一种称之为数据包的东西,它还提供对数据大小的重新组装功能,以适应不同网络对包大小的要求。 IP的责任就是把数据从源传送到目的地。它不负责保证传送可靠性,流控制,包顺序和其它对于主机到主机协议来说很普通的服务。 IP实现两个基本功能:寻址和分段。IP可以根据数据包包头中包括的目的地址将数据包传
2017-07-08 17:19:34 848
原创 LeetCode#7 Reverse Integer
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers.Note: The input is assumed to be a 32-bit signed integer. Your function shou
2017-07-05 19:18:01 317
原创 LeetCode#6 ZigZag Conversion
The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I
2017-07-05 19:10:19 351
原创 LeetCode#5* Longest Palindromic Substring
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: “babad” Output: “bab” Note: “aba” is also a valid answer.
2017-07-05 18:23:00 406
原创 LeetCode#4* Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1,
2017-07-05 15:36:44 368
原创 LeetCode#3* Longest Substring Without Repeating Characters
题目:Given a string, find the length of the longest substring without repeating characters. Examples: Given “abcabcbb”, the answer is “abc”, which the length is 3. Given “bbbbb”, the answer is “b
2017-07-05 12:52:21 275
原创 LeetCode#2 Add Two Numbers
题目:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return
2017-07-05 11:45:40 359
原创 LeetCode#1 Two Sum
题意:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same
2017-07-05 10:43:04 308
原创 网络层(二)ARP协议
ARP协议一.概述 简单地来说,ARP协议就是地址解析协议。对于以太网,数据链路层上是根据48bit的以太网地址来确定目的接口,设备驱动程序从不检查IP数据报中的目的IP地址。ARP协议为IP地址到对应的硬件地址之间提供动态映射。 以太网环境下,同一个网段的主机之间需要互相知道对方的MAC地址,才能访问。TCP/IP协议栈从上层到下层的封装过程中,第三层封装需要知道目的I
2017-07-04 17:52:25 3939 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人