2017年4月22日

LeetCode : Add Binary

摘要: Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.class Solution {public: strin... 阅读全文

posted @ 2017-04-22 16:32 gechen 阅读(93) 评论(0) 推荐(0) 编辑

2017年4月20日

LeetCode : Length of Last Word

摘要: Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the l... 阅读全文

posted @ 2017-04-20 15:47 gechen 阅读(73) 评论(0) 推荐(0) 编辑

2017年4月19日

LeetCode: Remove Linked List Elements

摘要: Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2... 阅读全文

posted @ 2017-04-19 22:23 gechen 阅读(80) 评论(0) 推荐(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 ... 阅读全文

posted @ 2017-04-19 15:28 gechen 阅读(73) 评论(0) 推荐(0) 编辑

2017年4月18日

对象管理资源

摘要: 今天看了下Effective C++的条款13:以对象管理资源,感觉十分有理,特此做一下笔记。假设我们使用一个用来描述投资行为的程序库,其中各式各样的投资类型都继承自一个根类 Investment://投资类型继承体系中的root classclass Investment{ ... 阅读全文

posted @ 2017-04-18 23:10 gechen 阅读(80) 评论(0) 推荐(0) 编辑

Linux 文件权限管理小记

摘要: Linux 文件权限管理: 一个目录同时具有读权限和执行权限才可以打开并查看内部文件,而一个目录要有写权限才允许在其中创建其它文件。这是因为目录文件实际保存着该目录里面的文件的列表等信息。adduser 和 useradd 的区别是什么?答:useradd 只创建用户,创建完了用 ... 阅读全文

posted @ 2017-04-18 16:56 gechen 阅读(111) 评论(0) 推荐(0) 编辑

LeetCode :Contains Duplicate II

摘要: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j]... 阅读全文

posted @ 2017-04-18 15:03 gechen 阅读(57) 评论(0) 推荐(0) 编辑

LeetCode : Implement Stack using Queues

摘要: Implement the following operations of a stack using queues.push(x) – Push element x onto stack. pop() – Removes the element on top of the sta... 阅读全文

posted @ 2017-04-18 14:36 gechen 阅读(72) 评论(0) 推荐(0) 编辑

2017年4月17日

hpp文件与h文件

摘要: 提起hpp文件,或许很多菜鸟会比较陌生,大家只知道.h文件,但是没听过hpp。实际上,hpp文件是将cpp文件混入h头文件中,在hpp文件内,实现与定义都包含在了同一个文件中,所以,该类的调用者只需要include这个hpp文件即可,无需再将cpp文件加到project中进行编译。... 阅读全文

posted @ 2017-04-17 23:30 gechen 阅读(544) 评论(0) 推荐(0) 编辑

LeetCode : Palindrome Linked List

摘要: Given a singly linked list, determine if it is a palindrome./** * Definition for singly-linked list. * struct ListNode { * int val; * ... 阅读全文

posted @ 2017-04-17 19:48 gechen 阅读(94) 评论(0) 推荐(0) 编辑

导航