4, String: flip the words in the string

https://leetcode-cn.com/problems/reverse-words-in-a-string/ Given a string, flip each word in the string one by one. Example 1: Input: "the sky is blue" Output: "blue is sky the" Example 2: Enter: "hello world!  " Output: "world! hello" Explanation: the input string can contain extra spaces bef ...

Posted by BostonMark on Wed, 15 Dec 2021 06:06:42 +0100

LeetCode Interview Topic 4

49. Alphabetic word grouping You are given an array of strings. Please group the heterographic words together. A list of results can be returned in any order. Alphabetic words are new words that result from rearranging the letters of the source word, and the letters in all source words are usually used exactly once. Example: input: strs = ...

Posted by webbnino on Tue, 14 Dec 2021 19:07:01 +0100

Leetcode question group 39 (greedy)

134. Gas stations There are , N , gas stations on a ring road, of which the , I , gas station has , gas[i] liters of gasoline. You have a car with unlimited fuel tank capacity. Driving from the i-th gas station to the i+1 , th gas station requires , cost[i] liters of gasoline. You start from one of the gas stations and start with a ...

Posted by hillbilly928 on Tue, 14 Dec 2021 05:22:55 +0100

Linked list must brush questions: speed double pointer, linked list reverse, find the midpoint template·····

234. Palindrome linked list Very representative! It includes linked list traversal, fast and slow pointer, midpoint template, linked list data comparison and linked list inversion! Very representative class Solution { public boolean isPalindrome(ListNode head) { if(head == null || head.next == null) return true; // Fi ...

Posted by luisantonio on Mon, 13 Dec 2021 15:36:32 +0100

Copy linked list with random pointer

LeetCode 138: copy linked list with random pointerhttps://leetcode-cn.com/probl...1, Title DescriptionGive you a linked list with a length of n. each node contains an additional random pointer random, which can point to any node or empty node in the linked list.Construct a deep copy of this linked list. The deep copy should consist of exactly n ...

Posted by achild on Mon, 13 Dec 2021 13:26:48 +0100

[problem solving report] guidelines of LeetCode zero foundation guide (Lecture 5)

☘ preface ☘ Today is the fourth day of the nine day training. I will record the learning contents and problem solutions and strive to be the class representative of 0.0 be careful!!!! The solution 1 of the problem solution is the solution to be mastered today, and the solution 2 is to study again when there is spare power, involving the foll ...

Posted by moreshion on Mon, 13 Dec 2021 07:15:20 +0100

[leetcode] search algorithm (sequential search, dichotomy, Fibonacci search, interpolation search, block search)

catalogue 1. Sequential search principle code expand 2. Dichotomy principle code 3. Fibonacci search principle code 4. Interpolation search principle code 5. Block search principle Code Reference Search algorithm can also be called search algorithm. It is to find a specific number from an ordered sequence. It is often used to ...

Posted by d3vilr3d on Sun, 12 Dec 2021 12:04:00 +0100

Divide Two Integers -- with detailed code and ideas

0 results 1 topic 2 ideas First, interpret the topic and deal with special cases (the value range of int is (- 2 ^ 31 (- 2147483648) ~ 2 ^ 31-1)), 1, when the divisor is equal to int_ When min, prevent the benefit when the divisor is 1;2. When the divisor is INT_MIN, the divisor is not equal to int_ It returns 0 when min, otherwise ...

Posted by quecoder on Sat, 11 Dec 2021 15:47:35 +0100

[problem solving report] LeetCode zero foundation guide (Lecture 3) cycle

☘ preface ☘ Today is the second day of the nine day training. I will record the learning contents and problem solutions and strive to be the class representative 0.0 be careful!!!! The first solution of problem solution is the solution to be mastered today. The second solution is to study again when you have spare power, involving the follow ...

Posted by walkonet on Sat, 11 Dec 2021 07:21:25 +0100

day6 list job

day6. List basis 1. Operation 1. Given a list of numbers, find the central element of the list. list1 = [18,99,87,54,63,54,55] if len(list1) // 2 == 0: print(list[len(list1)//2],list[len(list1)//2-1]) eles: print(lsit[len(list1)//2]) 2. Given a list of numbers, find the sum of all elements. list1 = [12,33,88,96,78] sum = 0 for x i ...

Posted by Waldir on Wed, 08 Dec 2021 12:55:43 +0100