原创 關於CTEX處理參考文獻編譯出錯的問題

使用Latex來排論文還是有不少細節比較頭疼的。 用IEEEtran模板編譯bib一直報錯,想了半天也沒找到問題。最後看了這篇帖子,是編譯順序的問題。工具貼,留着。 使用的是IEEEtran的模板。 因爲該文章之前在latex中編

原创 Merge Two Sorted Lists and Merge k Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nod

原创 二叉樹遍歷(前序、中序、後序)遞歸與非遞歸

二叉樹的非遞歸遍歷                                                             二叉樹的非遞歸遍歷          二叉樹是一種非常重要的數據結構,很多其它數據結構都

原创 Swap Nodes in Pairs and Reverse Nodes in k-Group

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

原创 IP地址劃分

A類地址 A類地址的表示範圍爲:0.0.0.0~126.255.255.255,默認網絡掩碼爲:255.0.0.0;A類地址分配給規模特別大的網絡使用。A類網絡用第一組數字表示網絡本身的地址,後面三組數字作爲連接於網絡上的主機

原创 幾個數組問題,持續更新

1.數組分段求最長 給定一個長度爲N(N>1)的整型數組A,可以將A劃分成左右兩個部分,左部分A[0..K],右部分A[K+1..N-1],K可以取值的範圍是[0,N-2]。求這麼多劃分方案中,左部分中的最大值減去右部分最大值的絕

原创 從尾到頭打印鏈表

輸入一個鏈表,從尾到頭打印鏈表每個節點的值。 可以用庫函數解題。每次在vector的頭部插入即可,沒什麼技術含量。代碼如下: class Solution { public: vector<int> printListF

原创 Valid Sudoku and Sudoku Solver

Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially fill

原创 Letter Combinations of a Phone Number

Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit

原创 Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For exampl

原创 3Sum, 3Sum Closest, 4 Sum

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 i

原创 Pow(x, n)

Implement pow(x, n). 實現一個浮點數冪運算的問題。這裏不需要考慮越界的問題,指數是int,也不需要處理分數指數的問題。爲了減小運行時間,我們採取折半相乘的方案,用遞歸來實現。用枚舉的方法也可以實現,但是代碼會

原创 Next Permutation

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers

原创 Rotate Image

You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Co

原创 Multiply Strings

Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can