C++语言学习
struggleee_luo
你当温柔,却有力量
展开
-
LeetCode算法题之Permutations
问题描述: Given a collection of numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1]. 给一个内部元素互不相等的集原创 2015-03-30 20:08:49 · 431 阅读 · 0 评论 -
Effective C++最新条款
说明:本内容摘自《Effective C++》侯捷译 01、视C++为一个语言联邦 同时支持过程形式,面向对象形式,函数形式,泛型形式,元编程形式的语言 02、尽量以const、enum,inline替换#define 对于单纯常量,最好以const对象或enums替换#define 对于形似函数的宏,最好改用inline函数替换#define 03、尽可能使用const 04、确定对原创 2015-07-09 18:29:46 · 450 阅读 · 0 评论 -
LeetCode算法题之Plus One
问题描述: 一个整数按位存储于一个vector中,排列顺序为:最高位在array[0] ,最低位在[n-1]。 解题思路: 从数组的最后一位开始加1,诸如999的数字加1后需要考虑进位。class Solution { public: vector<int> plusOne(vector<int>& digits) { vector<int> result;原创 2015-05-22 15:13:33 · 485 阅读 · 0 评论 -
LeetCode算法题之Merge Sorted Array
问题描述: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume that nums1 has enough space (size that is greater or equal to temp + n) to hol原创 2015-05-27 11:17:08 · 408 阅读 · 0 评论 -
LeetCode算法题之Next Permutation
问题描述 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possi原创 2015-04-21 12:02:11 · 486 阅读 · 0 评论 -
LeetCode算法题之int to Roman
问题描述: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 将数字转换为罗马数字表示。 解题思路: 按照罗马数字组数标准组合即可,附罗马数字百度百科:http://baike.baidu.com/link?url=UUF_E原创 2015-04-07 23:01:46 · 501 阅读 · 0 评论 -
LeetCode算法题之Valid Sudoku
问题描述: Determine if a Sudoku is valid, according to: http://sudoku.com.au/TheRules.aspx The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. A partially fi原创 2015-04-07 13:50:23 · 472 阅读 · 0 评论 -
LeetCode算法题之Multiply Strings
问题描述: Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative. 一个数字以字符串的形式相乘,这就意味着传统的乘法肯定不能满足,计算机表原创 2015-03-31 19:45:04 · 453 阅读 · 0 评论 -
LeetCode算法题之Rotate Image
问题描述: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? 要求不能另开空间,一开始理解错了,后来画图明白了 解题思路: 首先以对角线为轴对称交换,再以中间列原创 2015-03-31 14:02:07 · 938 阅读 · 0 评论 -
LeetCode算法题之Anagrams
问题描述: Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. Anagrams指的是具有如下特性的两个单词:在这两个单词当中,每一个英文字母(不区分大小写)所出现的次数都是相同的。 例如,“Unclear”和“Nu原创 2015-03-31 12:13:58 · 512 阅读 · 0 评论 -
LeetCode算法题之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 inpu原创 2015-05-27 15:19:57 · 420 阅读 · 0 评论