原创 [LeetCode] Reverse Nodes in k-Group每k個一組翻轉鏈表

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of no

原创 終端、shell、bash的區別聯繫

最佳答案 終端,即所謂的命令行界面,又稱命令終端,用戶輸入shell命令用的窗口,跟Windows裏的DOS界面差不多。 shell,Shell就是用戶和操作系統之間的殼,中介,GUI和CLI都算是Shell,登陸終端可以是登

原创 Java大數類排序

大數類排序 import java.lang.reflect.Array; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; pu

原创 反轉鏈表

輸入一個鏈表,反轉鏈表後,輸出鏈表的所有元素。 C++: /* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), nex

原创 阻塞非阻塞與同步異步的區別

作者:嚴肅 鏈接:https://www.zhihu.com/question/19732473/answer/20851256 來源:知乎 著作權歸作者所有。商業轉載請聯繫作者獲得授權,非商業轉載請註明出處。 “阻塞”與"非阻塞"與"

原创 UVALive 7040 Color (容斥原理 + 組合數學遞推公式 + 求逆元 + 基礎數論)

搬運題解系列:http://blog.csdn.net/qingshui23/article/details/51125323 傳送門  英文題目: Recently, Mr. Big recieved n owers from h

原创 GYM100526 Interesting Integers(擴展歐幾里得)

搬運大佬的題解系列:http://blog.csdn.net/u010568270/article/details/52315019 題目鏈接:   http://codeforces.com/gym/100526   http:

原创 UVALive 7147 World Cup(貪心+分類討論)

大佬的講解:http://www.cnblogs.com/qq2424260747/p/4905426.html 題目大意:n個隊伍參加比賽,有m個隊伍晉級,n個隊伍有n-1場比賽,每兩個隊伍之間都有一場比賽。一場比賽贏的得a分,輸的

原创 超級讀寫掛

#define FI(n) FastIO::read(n) namespace FastIO { const int SIZE = 1 << 16; char buf[SIZE], obuf[SIZE], str[60]; int

原创 inline函數的定義放在頭文件中

inline是加在實現上,就算加在聲明上,編譯器也會忽略掉。內聯展開是在編譯時進行的,只有鏈接的時候源文件之間纔有關係。所以內聯要想跨源文件必須把實現寫在頭文件裏。如果一個inline函數會在多個源文件中被用到,那麼必須把它定義在頭文件

原创 [劍指Offer]最小的K個數

/* 思路:o(n)的算法,只有當可以更改輸入的數組時候纔可用 從數組中次數超過一半的數字得到啓發。 就是用快速排序的思想,找到第K大的數,那麼左邊都是比它小的數了 */ class Solution { public: vect

原创 Java 接口(interface)的用途和好處

一. 對接口的三個疑問 很多初學者都大概清楚interface是1個什麼, 我們可以定義1個接口, 然後在裏面定義一兩個常量(static final) 或抽象方法. 然後以後寫的類就可以實現這個接口, 重寫裏面的抽象方法. 

原创 [LeetCode147]Insertion Sort List(鏈表插入排序)

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(i

原创 [LeetCode]Flatten Binary Tree to Linked List(二叉樹轉鏈表)

Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 /

原创 [LeetCode386]Lexicographical Numbers(n以內的數字按字典序輸出)

Given an integer n, return 1 - n in lexicographical order. For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,