Analysis of leetcode problem solving ideas (100) 860 - 866 questions

Lemonade change At the lemonade stand, each glass of lemonade costs $5. Customers line up to buy your products (in the order of bill payment) one cup at a time. Each customer buys only one glass of lemonade and pays you $5, $10 or $20. You must give each customer the correct change, that is, the net transaction is that each customer pays you $5 ...

Posted by modcar on Mon, 06 Dec 2021 14:36:55 -0800

Leetcode.1005. Maximized array sum after K negations - greedy + count sorting

12.6 one question per day - maximum array sum after K inversions Enter an array of integers and an integer k to modify the array as follows 1. Select a subscript i and replace num [i] with - num [i] 2. Repeat this process exactly k times. You can select the same subscript i multiple times. When the array is modified in this way, the maximum po ...

Posted by nicholasstephan on Mon, 06 Dec 2021 13:03:44 -0800

[LeetCode] 2095. Delete the Middle Node of a Linked List as the intermediate node of the chain list

Author: Ming Xue Candleid: fuxuemingzhuPersonal blog: http://fuxuemingzhu.cn/Public number: snowy candlesKey words in this article: Leetcode, buckle, brush title, Python, C++, chain list, intermediate node, delete Title Address: https://leetcode-cn.com/problems/delete-the-middle-node-of-a-linked-list/ Title Description Give you the he ...

Posted by Shendemiar on Mon, 06 Dec 2021 09:36:46 -0800

167. Sum of two II - input ordered array - Java

167. Sum of two II - input ordered array Topic overview Give an array of integers that have been arranged in non decreasing order numbers ,Please find two numbers from the array. The sum of the two numbers is equal to the target number target . The function should return the subscript values of these two numbers as an array of integers ...

Posted by Zamees on Sun, 05 Dec 2021 17:16:03 -0800

Common oj problems of stack and queue (bracket matching problem, stack implementation queue, queue implementation stack, design loop queue)

1, Bracket matching problem 1. Title Requirements:     2. General idea After traversing the string, if it is an open parenthesis, let it enter the stack. If it is a right parenthesis, let it match the top element of the stack (provided that there are elements in the stack). If the matching is successful, let the top element out of th ...

Posted by aquayle on Sun, 05 Dec 2021 13:43:55 -0800

Dijkstra algorithm details (single source shortest path algorithm)

Most of us may know BFS and DFS better. For Dijkstra algorithm, it is the algorithm to solve the single source shortest path problem in the graph algorithm structure. It is probably such a weighted graph. Dijkstra algorithm can calculate the shortest path from any node to other nodes. (single source shortest path problem), Dijkstra algorithm c ...

Posted by hayson1991 on Sun, 05 Dec 2021 12:37:44 -0800

Data structure Java data structure stack and queue and LeetCode related interview questions

1. Stack 1.1 concept Stack: a special linear table that allows insertion and deletion of elements only at a fixed end. One end for data insertion and deletion is called the top of the stack, and the other end is called the bottom of the stack. The data elements in the stack follow the principle of Last In First Out LIFO (Last In First Out ...

Posted by Mohammad on Sun, 05 Dec 2021 11:30:29 -0800

Chapter 87 LeetCode refers to the maximum sum of continuous subarrays of Offer dynamic programming

1. Title Description Enter an integer array. One or more consecutive integers in the array form a sub array. Find the maximum value of the sum of all subarrays. The required time complexity is O(n). Example 1: Input: num = [- 2,1, - 3,4, - 1,2,1, - 5,4] Output: 6 Explanation: the maximum sum of continuous subarray [4, - 1,2,1] is 6. ...

Posted by Shaudh on Sun, 05 Dec 2021 04:53:43 -0800

Leetcode game 270 weekly question solution

Problem A - Find the 3-bit even number meaning of the title Any three numbers in the array are spliced into three digits. Non even numbers and no leading 0 are required. All qualified numbers are returned in ascending order thinking See that the range of the given array is 100, and directly triple loop. Since the requirement is not repeated, i ...

Posted by derekbelcher on Sat, 04 Dec 2021 22:51:46 -0800

leetcode-97. Interleaved string

subject Link: https://leetcode-cn.com/problems/interleaving-string Given the three strings s1, s2 and s3, please help verify whether s3 is composed of s1 and s2 interleaving. The definition and process of interleaving two strings s and t are as follows, in which each string will be divided into several non empty substrings: s = s1 + s2 + ... ...

Posted by devil6600 on Sat, 04 Dec 2021 15:28:37 -0800