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
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
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/
Give you the he ...
Posted by Shendemiar on Mon, 06 Dec 2021 09:36:46 -0800
167. Sum of two II - input ordered array
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
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
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
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
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).
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
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
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