Codeforces round #739 (Div. 3) (supplementary question)

D. Make a Power of Two Question meaning: for a given number, there are two operations. You can choose to delete the number at any position, or add a number to the right of the number. Ask the operation for at least several times to turn the number into a power of 2 Idea: directly preprocess allUTF-8...

Posted by -twenty on Mon, 20 Dec 2021 09:21:45 +1030

[Leetcode-977] Squares of a Sorted Array

preface Github: Leetcode-977. Squares of a Sorted Array (code implementation) subject Leetcode-977. Squares of a Sorted Array Leetcode-977. Square of ordered array Topic meaning Calculate the square value of each element of the self increasing array and return a new array of square values of eaUTF-8...

Posted by meiamsome on Sat, 08 Jan 2022 20:00:38 +1030

[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "string addition"

1, Title Requirements Given two non negative integers num1 and num2 in string form, calculate their sum and return them in string form as well.You cannot use any built-in library for handling large integers (such as BigInteger), nor can you directly convert the input string to integer form.ExamUTF-8...

Posted by myflashstore on Fri, 04 Feb 2022 16:16:11 +1030

Phase I about array, linked list and string de duplication (double pointer)

1. LeetCode316 Remove duplicate letters This question has three requirements: 1. Remove duplicate elements from string 2. The alphabetical order in the string cannot be disordered 3. The minimum dictionary order of the returned string is required Here, the first two requirements are easy to meeUTF-8...

Posted by archonis on Thu, 10 Feb 2022 09:36:22 +1030

LeetCode data structure linked list

Day 7 - linked list 141 ring linked list Idea 1: data structure method The problem is to judge whether there is a ring in the linked list. If there is a ring, the cycle cannot exit when traversing, and some nodes will be traversed twice. Therefore, we can use the data structure to count the acUTF-8...

Posted by lilRachie on Sun, 20 Mar 2022 11:55:59 +1030

Adjust the array order so that odd numbers precede even numbers

Sword finger offer 21 adjusts the array order so that odd numbers precede even numbers LeetCode 905 Enter an integer array, and implement a function to adjust the order of numbers in the array, so that all odd numbers are in the first half of the array, and all even numbers are in the second hUTF-8...

Posted by Calimero on Wed, 13 Apr 2022 19:44:47 +0930

A set of template second kill sliding window & leetcode Sliding Window Title Summary

Sliding window title template step1: maintain variables according to the meaning of the question And SumMax length_ Len, min length_ lenDo not repeat hashmap = {} Step 2: start position and end position of the window step3: write judgment statements according to conditions and maintain variableUTF-8...

Posted by yozyk on Sat, 16 Apr 2022 15:48:13 +0930

Gorang version of high-frequency algorithm of linked list (clear thinking and detailed comments)

The algorithm questions of the linked list are the most common in the interview. Although the questions are simple, they also test the logical thinking and algorithm proficiency of the interviewees. Let's look at their conventional solutions through several common linked list questions! (click UTF-8...

Posted by LiamOReilly on Fri, 12 Aug 2022 02:19:53 +0930