Given an array of integers, every element appears three times except for one. Find that single one. …
LeetCode | Linked List Cycle(判断链表是否有环)
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space?…
LeetCode | Reorder List(链表重新排序)
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must …
LeetCode | Insertion Sort List(插入法排序链表)
Sort a linked list using insertion sort. 题目解析: 链表思路不难,但是指针比较麻烦,要细心才行。这道题让我调了半天,原来是一个指针赋错了,因为用的变量p和q,导致很长时间才发现……
LeetCode | Evaluate Reverse Polish Notation(逆波兰式求值)
Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +,&nb…
LeetCode | 3Sum(三个数的和等于0)
Given an array S of n integers, are there elements a, b, c in S&n…
LeetCode | Reverse Words in a String(字符串中的单词序反转)
Given an input string, reverse the string word by word. For example, Given s = “the sky is blue“, …
LeetCode | 3Sum Closest(找到三个数使其和与target最接近)
Given an array S of n integers, find three integers in S such that the sum is cl…
LeetCode | 4Sum(四个数的和)
Given an array S of n integers, are there elements a, b, c, and d …
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…
LeetCode | Divide Two Integers(两个数相除)
Divide two integers without using multiplication, division and mod operator. 题目解析: 求两个数相除,不能用乘除法。那么可以用加减法一点一点算…
LeetCode | Substring with Concatenation of All Words(链接所有单词的子串)
You are given a string, S, and a list of words, L, that are all of the same length. Find all startin…