原创 leetCode 141. Linked List Cycle 鏈表

141. Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using ex

原创 leetCode 237. Delete Node in a Linked List 鏈表

237. Delete Node in a Linked ListWrite a function to delete a node (except the tail) in a singly linked list, given only

原创 單鏈表的反轉問題

單鏈表的反轉問題單鏈表反轉問題經常會遇到。在此記錄一下,以便查閱方便。如果反轉一個有頭結點的使用下面的方法比較合適。//反轉單鏈表,此單鏈錶帶有頭節點。 //思想:使用tmp臨時指針保存頭結點與鏈表的關係 typedef struct Li

原创 leetCode 19. Remove Nth Node From End of List 鏈表

19. Remove Nth Node From End of ListGiven a linked list, remove the nth node from the end of list and return its head.Fo

原创 leetCode 119. Pascal's Triangle II 數組

119. Pascal's Triangle IIGiven an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [

原创 leetCode 36. Valid Sudoku(數獨) 哈希

36. Valid Sudoku(合法數獨)Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be

原创 leetCode 160. Intersection of Two Linked Lists 鏈表

160. Intersection of Two Linked ListsWrite a program to find the node at which the intersection of two singly linked lis

原创 leetCode 24. Swap Nodes in Pairs 鏈表

24. Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3-

原创 【IPv6】NS,NA 報文學習

IPV6鄰居發現報文學習IPv6的鄰節點發現協議的所有功能都由以下報文來完成:l 路由器請求報文;l 路由器公告報文;l 鄰節點請求報文;l 鄰節點公告報文;l 重定向報文。一.鄰節點請求報文詳細分析請求報文分爲2類:1. 地址衝突檢測(D

原创 leetCode 121. Best Time to Buy and Sell Stock 數組

121. Best Time to Buy and Sell StockSay you have an array for which the ith element is the price of a given stock on day

原创 獲取內存使用率(Linux C)

#define SYS_MEM_NAME_LEN 20 #define SYS_MEM_BUFF_LEN 256 #define SYS_100_PERSENT 100 int get_sysMemUsage() { FILE *

原创 wireshark解析報文一點根據

wireshark解析報文一點根據 問題:遇到一個問題,net-snmp發出trap的時候,通過wireshark抓包發現只能發送知名端口162的告警報文。處理過程如下: 檢查代碼:經過代碼排查發現net-snmp沒有對端口做任何限制。

原创 【IPv6】鄰節點不可到達檢測學習(NUD)

鄰節點不可到達檢測鄰節點不可到達檢測方法有2種:1. 通過發送單播鄰節點請求報文和接收響應請求的鄰節點公告報文來完成。2. 藉助上層協議確定可達性。(TCP) 通過NS/NA報文進行NUD檢測響應請求的鄰節點公告報文僅用於響應鄰節點請求報文

原创 leetCode 383. Ransom Note 字符串

383. Ransom NoteGiven an arbitrary ransom note string and another string containing letters from all the magazines, writ

原创 獲取linux內核所有ip

獲取linux內核所有ip(C語言) 經常遇到獲取接口ip。記錄一下,方便後續使用。 #include <net/if.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <