Leetcode
陈胖纸
这个作者很懒,什么都没留下…
展开
-
75. Sort Colors
Java 75.Sort Colors原创 2022-07-04 23:31:31 · 118 阅读 · 1 评论 -
451. Sort Characters By Frequency
【Leetcode】Java 451. Sort Characters By Frequency原创 2022-07-04 23:30:49 · 129 阅读 · 0 评论 -
215. Kth Largest Element in an Array
LeetCode Java 215. Kth Largest Element in an Array原创 2022-06-27 23:41:53 · 135 阅读 · 0 评论 -
524. Longest Word in Dictionary through Deleting
【Leetcode】 Java 524. Longest Word in Dictionary through Deleting原创 2022-06-26 21:07:01 · 159 阅读 · 0 评论 -
141. Linked List Cycle
Java LeetCode 141. Linked List Cycle原创 2022-06-26 20:10:43 · 98 阅读 · 0 评论 -
88. Merge Sorted Array
【Java】LeetCode 88. Merge Sorted Array原创 2022-06-26 11:00:52 · 125 阅读 · 0 评论 -
680. Valid Palindrome II
680. Valid Palindrome II这是一个双指针问题,但是要注意删除后面或者前面的数有两个选择,会出现不该删除该字母但是结果旁边,例如,我下面这段代码就是这样的问题:改过来之后,再定义一个函数来判断大公搞成了!!...原创 2022-06-26 10:14:34 · 73 阅读 · 0 评论 -
345. Reverse Vowels of a String
【LeetCode】Java 345. Reverse Vowels of a String原创 2022-06-24 23:30:53 · 89 阅读 · 0 评论 -
633. Sum of Square Numbers
LeetCode 633. Sum of Square NumbersGiven a non-negative integer , decide whether there’re two integers and such that Constraints:典型的双指针问题,不过多赘述了,但是这里注意,平方之后超过了int的范围,所用要用long类型来解这个题。...原创 2022-06-23 23:12:52 · 64 阅读 · 0 评论 -
1.TwoSum
LeetCode-Java 1.TwoSum原创 2022-06-23 20:11:36 · 106 阅读 · 0 评论 -
【LeetCode】C++ 567. Permutation in String
Given two stringss1ands2, returntrueifs2contains a permutation ofs1, orfalseotherwise.In other words, returntrueif one ofs1's permutations is the substring ofs2.Example 1:Input: s1 = "ab", s2 = "eidbaooo"Output: trueExplanation: s2...原创 2022-03-08 20:19:58 · 409 阅读 · 0 评论 -
【LeetCode】C++ 3. Longest Substring Without Repeating Characters
Given a strings, find the length of thelongest substringwithout repeating characters.Example 1:Input: s = "abcabcbb"Output: 3Explanation: The answer is "abc", with the length of 3.Example 2:Input: s = "bbbbb"Output: 1Explanation: The an...原创 2022-03-08 19:32:28 · 318 阅读 · 0 评论 -
【LeetCode】19. Remove Nth Node From End of List
Given theheadof a linked list, remove thenthnode from the end of the list and return its head.Example 1:Input: head = [1,2,3,4,5], n = 2Output: [1,2,3,5]Example 2:Input: head = [1], n = 1Output: []Example 3:Input: head = [1,2], n...原创 2022-03-08 19:31:24 · 58 阅读 · 0 评论 -
【LeetCode】876. Middle of the Linked List
Given theheadof a singly linked list, returnthe middle node of the linked list.If there are two middle nodes, returnthe second middlenode.Example 1:Input: head = [1,2,3,4,5]Output: [3,4,5]Explanation: The middle node of the list is node 3...原创 2022-03-08 11:35:11 · 75 阅读 · 0 评论 -
【LeetCode】c++ 557. Reverse Words in a String III
Given a strings, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: s = "Let's take LeetCode contest"Output: "s'teL ekat edoCteeL tsetnoc"Example 2:Input: .原创 2022-03-08 11:10:34 · 391 阅读 · 0 评论 -
【Leetcode】344. Reverse String C++
Write a function that reverses a string. The input string is given as an array of characterss.You must do this by modifying the input arrayin-placewithO(1)extra memory.Example 1:Input: s = ["h","e","l","l","o"]Output: ["o","l","l","e","h"]...原创 2022-03-08 07:56:09 · 421 阅读 · 0 评论 -
167. Two Sum II - Input Array Is Sorted
Given a1-indexedarray of integersnumbersthat is alreadysorted in non-decreasing order, find two numbers such that they add up to a specifictargetnumber. Let these two numbers benumbers[index1]andnumbers[index2]where1 <= index1< index2&l...原创 2022-03-03 22:26:10 · 93 阅读 · 0 评论 -
189. Rotate Array
Given an array, rotate the array to the right byksteps, wherekis non-negative.Example 1:Input: nums = [1,2,3,4,5,6,7], k = 3Output: [5,6,7,1,2,3,4]Explanation:rotate 1 steps to the right: [7,1,2,3,4,5,6]rotate 2 steps to the right: [6,7,1,2,...原创 2022-03-03 21:56:01 · 71 阅读 · 0 评论 -
283. Move Zeroes
Given an integer arraynums, move all0's to the end of it while maintaining the relative order of the non-zero elements.Notethat you must do this in-place without making a copy of the array.Example 1:Input: nums = [0,1,0,3,12]Output: [1,3,12,0,...原创 2022-03-03 21:55:11 · 57 阅读 · 0 评论 -
977. Squares of a Sorted Array C++
Given an integer arraynumssorted innon-decreasingorder, returnan array ofthe squares of each numbersorted in non-decreasing order.Example 1:Input: nums = [-4,-1,0,3,10]Output: [0,1,9,16,100]Explanation: After squaring, the array becomes [16...原创 2022-03-02 11:17:18 · 99 阅读 · 0 评论 -
【LeetCode】35. Search Insert Position C++
Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You mustwrite an algorithm withO(log n)runtime complexity.Example 1:I...原创 2022-03-02 10:58:38 · 358 阅读 · 0 评论 -
278. First Bad Version
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version原创 2022-03-02 10:43:13 · 81 阅读 · 0 评论 -
278. First Bad Version C++
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version原创 2022-03-02 10:23:03 · 544 阅读 · 0 评论 -
Leetcode 704. Binary Search C++
Leetcode 704. Binary Search C++原创 2022-03-02 10:10:32 · 380 阅读 · 0 评论