原创 Subsets leetcode

Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be in non-descendi

原创 C++堆,棧,靜態存儲區介紹

1、棧區(stack)— 由編譯器自動分配釋放 ,存放函數參數值,局部變量值等。其 操作方式類似於數據結構中棧。 2、堆區(heap) — 一般由程序員分配釋放, 若程序員不釋放,程序結束時可能由OS回 收 。注意它與數據結構中堆是兩回事

原创 Reverse Nodes in k-Group leetcode

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

原创 Two Sum leetcode

Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum s

原创 gitlab 解決502問題

在配置文件/ect/gitlab/gitlab.rv中寫如下語句: external_url 'IP:PORT'   一般安裝成功gitlab後,該文件會自動生成這條配置,IP和端口號是自己的服務器IP和端口號,這個地方一定要注意端口號不

原创 Valid Sudoku and Sudoku Solver leetcode

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

原创 Distinct Subsequences leetcode

Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a

原创 Gas Station leetcode

There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with

原创 Convert Sorted List to Binary Search Tree leetcode

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 方法一:把鏈表裏的

原创 Combination Sum leetcode

Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate n

原创 Triangle leetcode

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row

原创 怎樣用指定的隨機數生成函數來實現新的隨機數生成函數

阿里巴巴筆試題:假設函數rand_k會隨機返回一個【1,k】之間的隨機數(k>=2),並且每個整數出現的概率相等。目前有 rand_7,通過調用ra

原创 Longest Consecutive Sequence leetcode

Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given

原创 Unique Binary Search Trees II leetcode

Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n 

原创 3Sum leetcode

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 in