LeetCode greedy topic java code thinking solution

Constantly updating Problem solution 455 distribution of biscuits Suppose you are a great parent and want to give your children some cookies. However, each child can only give one biscuit at most. For each child i, there is an appetite value gi, which is the minimum size of biscuits that can satisfy the children's appetite; And every cookie ...

Posted by mechamecha on Wed, 18 May 2022 06:40:12 +0300

Data structure and program design of leetcode in the direction of postgraduate entrance examination (miscellaneous articles such as number and stack, including train of thought solutions)

Digital problem 9. Number of palindromes Algorithm idea: 1. First, judge whether x is a negative number. If it is a negative number, it directly returns false without conversion 2. Assign the palindrome number y according to the flashback until Y > = X. at this time, if x = = y | x = = Y / 10, it is the palindrome number, otherwise it ...

Posted by elwadhos on Tue, 17 May 2022 18:01:13 +0300

leetcode | stack and queue

232. Implement queue with stack (simple) Use the stack to implement the following operations of the queue: push(x) -- put an element at the end of the queue. pop() -- removes the element from the queue header. peek() -- returns the element at the head of the queue. empty() -- returns whether the queue is empty. Example: MyQueue queue = new MyQ ...

Posted by marian on Tue, 17 May 2022 14:29:27 +0300

[western method takes you to learn algorithm] get the prefix and

I spent a few days selecting five topics with the same ideas from the force button to help you solve the problem. If you think the article is useful to you, remember to praise and share it. Let me see your recognition and have the motivation to continue to do it. 467. The unique substring in the surrounding string (medium) 795. Number of int ...

Posted by caspert_ghost on Sat, 14 May 2022 09:02:30 +0300

LeetCode_ Interview question 01.05 One edit

LeetCode_ Interview question 01.05 Primary edit [medium] Topic: Title: There are three editing operations for Strings: insert a character, delete a character, or replace a character. Given two strings, write a function to determine whether they require only one (or zero) edit. Example 1: input: first = "pale" second = "ple" output: Tru ...

Posted by Tyrant on Fri, 13 May 2022 23:56:30 +0300

Leetcode PHP solution -- d124 1175 Prime Arrangements

D124 1175. Prime Arrangements Title Link 1175. Prime Arrangements Topic analysis This question, give a number n to generate an array from 1 to N. how many permutations make the number of prime digits prime? Where 1 < = n < = 100 Since the final return value may be large, please return the result after mod (10 * * 9 + 7). thinking In other ...

Posted by raquelzinha on Fri, 13 May 2022 17:15:13 +0300

CMake multi main() entrance project construction (brush topic direction)

In ACM algorithm competition / LeetCode using C + + to brush questions and other scenarios, usually: A lot of C + + source code needs to be maintained Multiple main function entries are required to facilitate test execution Some self written public function class libraries (such as debug output vector, etc.) are referenced in multiple files T ...

Posted by DarkendSoul on Thu, 12 May 2022 18:47:09 +0300

[LeetCode]622. Design circular queue (Java)

Design your loop queue implementation. Circular queue is a linear data structure whose operation performance is based on FIFO (first in first out) principle, and the tail of the queue is connected after the head of the queue to form a loop. It is also called "ring buffer". One of the benefits of circular queues is that we can use the ...

Posted by dan231 on Thu, 12 May 2022 00:02:06 +0300

LeetCode question brushing notes (Java) -- updated to 402 questions

preface Questions that need to open vip will be skipped temporarily Note navigation Click the link to jump to the navigation link of all brush notes 401. Binary Watch The top of the binary watch has 4 LEDs representing hours (0-11) and the bottom 6 LEDs representing minutes (0-59). Each LED represents a 0 or 1, with the lowest bit on ...

Posted by CodeMama on Tue, 10 May 2022 15:53:22 +0300

Dynamic programming & explanation of the idea of divide and rule (taking leetcode question 53: finding the maximum subsequence as an example) (transferred from the explanation of leader liwei1419 in the comment area)

Write in front: this blog is only for my summary and notes, not for any commercial purpose. If there is any infringement, please contact me to delete it. Thank you. (see the end for reprint link) Method 1: violent solution (understand, friends who are not interested can skip directly) Enumerate all subintervals: Use double-layer loop to enum ...

Posted by anna_cm on Mon, 09 May 2022 20:47:58 +0300