原创 leetcode之387. First Unique Character in a String(C++解法)

題目: Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, retur

原创 計算機原理 —— 主板與內存映射

原地址:http://liaoph.com/motherboard-and-memory-map/ 感興趣存過來的哈 我打算寫幾篇關於計算機內部原理的文章,來幫助解釋現代操作系統內核是如何工作的。我希望這些文章能對那些對這部分內容感興

原创 linux ubuntu編寫內核模塊並添加

內核版本3.13.8; 實驗平臺:虛擬機 unbuntu14.04 1、編輯文件“mymod.c” #include <linux/module.h> #include <linux/timer.h> #include <linux/er

原创 leetcode之242. Valid Anagram(C++解法)

題目 Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = “anagram”,

原创 leetcode之83. Remove Duplicates from Sorted List(C++實現 鏈表去重)

題目: Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->

原创 leetcode之169. Majority Element

原題: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊

原创 leetcode之92. Reverse Linked List II(C++讀錯題版本,交換一個鏈表中指定的兩個位置上的元素)

Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m

原创 leetcode之7. Reverse Integer(要能存儲大數,判斷溢出)

原題: Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 ********************

原创 leetcode之349. Intersection of Two Arrays (C++解法 哈希表和vector)

原題: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2

原创 leetcode之26. Remove Duplicates from Sorted Array(C++解法)

題目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new le

原创 leetcode之389. Find the Difference(C++解法)

原題: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling strin

原创 leetcode之70. Climbing Stairs(C++解法 動態規劃思想)

原題: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps.

原创 leetcode之137. Single Number II(C++解法 哈希表計數)

題目: Given an array of integers, every element appears three times except for one. Find that single one. Note: Your al

原创 leetcode之24. Swap Nodes in Pairs(C++實現&鏈表實現和整體測試)

題目: Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should

原创 leetcode之328. Odd Even Linked List(C++解法)

題目: Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talki