题目地址:https://leetcode-cn.com/probl…给定一个链表,判断链表中是否有环。 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如…
分类:LeetCode
LeetCode算法题-Kth Largest Element in a Stream(Java实现)
这是悦乐书的第296次更新,第315篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第164题(顺位题号是703)。设计一个类来查找流中第k个最大元素。请注意,它是排序顺序中的第k个最大元素,…
Leetcode - Count of Range Sum
My code: public class Solution { public int countRangeSum(int[] nums, int lower, int upper) { if (nums == null…
[Leetcode] Longest Palindromic Substring 最长回文子字符串
Longest Palindromic Substring Given a string S, find the longest palindromic substring in S. You may assume th…
191. Number of 1 Bits
191. Number of 1 Bits 题目: https://leetcode.com/problems/number-of-1-bits/ 难度: Easy 转成二进制,数1的个数 class Solution(…
[LintCode][DFS] Find the Connected Component in the Undirected Graph
Problem Find the number connected component in the undirected graph. Each node in the graph contains a label a…
LeetCode算法题-Reverse Vowels of a String(Java实现-四种解法)
这是悦乐书的第206次更新,第218篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第74题(顺位题号是345)。编写一个函数,它将一个字符串作为输入,并仅反转一个字符串的元音。例如: 输入:…
368. Largest Divisible Subset
Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements i…
LeetCode刷题之Happy Number
Problem Write an algorithm to determine if a number is “happy”. A happy number is a number defined…
[LeetCode] Range Sum Query - Immutable 区域和检索 - 不可变
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. E…
[LeetCode] Predict the Winner 预测赢家
Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either …
LeetCode | Generate Parentheses
题目: Given n pairs of parentheses, write a function to generate all combinations of well-formed paren…