Problem Reverse a singly linked list. Hint: A linked list can be reversed either iteratively or recursively. C…
分类:LeetCode
109. Convert Sorted List to Binary Search Tree
欢迎fork and star:Nowcoder-Repository-github 109. Convert Sorted List to Binary Search Tree 题目 Given a singly li…
313. Super Ugly Number
Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime fact…
LeetCode 3. Longest Substring Without Repeating Characters
题目 给定一个字符串,请找出其中无重复字符的最长子字符串。 样例 例如,在”abcabcbb”中,其无重复字符的最长子字符串是”abc”,其长度为 3。 对于,”…
277. Find the Celebrity
Problem Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one…
29. 两数相除(Swift版)
一、题目 给定两个整数,被除数 dividend 和除数 divisor。将两数相除,要求不使用乘法、除法和 mod 运算符。 返回被除数 dividend 除以除数 divisor 得到的商。 示例 1: 输入: di…
[剑指offer] 字符串的排列
本文首发于我的个人博客:尾尾部落 题目描述 输入一个字符串,按字典序打印出该字符串中字符的所有排列。例如输入字符串abc,则打印出由字符a,b,c所能排列出来的所有字符串abc,acb,bac,bca,cab和cba。 …
[LeetCode] Unique Binary Search Trees II 独一无二的二叉搜索树之二
Given n, generate all structurally unique BST’s (binary search trees) that store v…
[LeetCode] Reverse Linked List 倒置链表,Reverse Linked List II
Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3-…
[LeetCode] Group Shifted Strings 群组偏移字符串
Given a string, we can “shift” each of its letter to its successive letter, for example:&nb…
[LeetCode] Find the Duplicate Number 寻找重复数
Given an array nums containing n + 1 integers where each integer is between 1 and&n…
LeetCode | Gray Code
题目: The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-n…