题目描述 Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2-&g…
标签:LeetCode题目解答
129. Sum Root to Leaf Numbers
欢迎fork and star:Nowcoder-Repository-github 129. Sum Root to Leaf Numbers 题目 Given a binary tree containing dig…
[LeetCode] Single Number III 单独的数字之三,Single Number II
Given an array of numbers nums, in which exactly two elements appear only once and all the other e…
[LeetCode] Longest Palindrome 最长回文串
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindr…
LeetCode | Gas Station
题目: There are N gas stations along a circular route, where the amount of gas at station i …
【leetcode】50. Pow(x, n) 幂计算
1. 题目 Implement pow(x, n). 2. 思路 每次翻倍,如果当前翻倍的幂次在n的二进制位内,则乘入最后结果中,否则跳过继续。特殊场景较多,要特别考虑: 幂次n可能是负数,这是要注意转换为正数后,最后求…
[LeetCode] Generalized Abbreviation 通用简写
Write a function to generate the generalized abbreviations of a word. Example: Given word = "word"…
[LeetCode] Number of Connected Components in an Undirected Graph 无向图中的连通区域的个数
Given n nodes labeled from 0 to n – 1 and a list of undirected edges (each edge is a pair of node…
[LeetCode] Circular Array Loop 环形数组循环
You are given an array of positive and negative integers. If a number n at an index is positive, then m…
[LeetCode] Max Consecutive Ones II 最大连续1的个数之二
Given a binary array, find the maximum number of consecutive 1s in this array if you can flip at most o…
[LeetCode] Design HashSet 设计HashSet
Design a HashSet without using any built-in hash table libraries. To be specific, your design shou…
LeetCode | Reverse Words in a String
题目: Given an input string, reverse the string word by word. For example, Given s = “the sky is blue̶…