[link list of Leetcode's notes] interview question 02.04 Split linked list

😈 Blog home page: 🐼 Hello, everyone. My name is classmate Zhang🐼 πŸ’– Welcome to praise πŸ‘ Collection πŸ’— Leaving a message. πŸ“ Welcome to discuss! πŸ‘€ 🎡 This article was originally written by [Hello, my name is classmate Zhang] and started at CSDN 🌟🌟🌟 ✨ Boutique column (updated from time to time) [data structure + algorithm] [notes][C l ...

Posted by eriksmoen on Thu, 13 Jan 2022 10:54:27 +0100

Array training camp 1 (leetcode)

1. Most elements Title Description: Given an array of size n, find most of its elements. Most elements refer to elements that appear more than ⌊ n/2 βŒ‹ in the array. You can assume that the array is non empty and that there are always many elements in a given array. Idea: code: //Time complex O(N) space comple ...

Posted by blueman378 on Thu, 13 Jan 2022 09:35:53 +0100

[Leetcode] [learning plan] [depth first search] maximum area of the island

Title Source: https://leetcode-cn.com/problems/max-area-of-island/ Original solution: https://leetcode-cn.com/problems/max-area-of-island/solution/biao-zhun-javadong-tai-gui-hua-jie-fa-100-by-mark-/ Maximum area of the island Give you a binary matrix grid of size m x n.An island is a combination of some adjacent 1s (representing la ...

Posted by starphp on Thu, 13 Jan 2022 08:42:27 +0100

Linked list of the second day of data structure

Day 2 - linked list In fact, the linked list is relatively simple. For a data field and a pointer field, there are only a few common solutions, such as double pointers. But since I am a Java to C + +, the difficulty for me is to remember to release the space for application. So practice and record. Remove linked list elements Force buckle or ...

Posted by jonwondering on Wed, 12 Jan 2022 19:12:58 +0100

LeetCode question brushing record

LeetCode question brushing record 4. Find the median of two positively ordered arrays Solution idea: the topic requires to find the median of two ordered arrays. A very direct and clear idea is to combine the two ordered arrays into one ordered array, and then find the median mednum = (Num [len / 2] + num [(len - 1) / 2]) / 2. The time complexi ...

Posted by ionik on Wed, 12 Jan 2022 04:43:07 +0100

Force deduction brush question - array 4

Yang Hui triangle Topic introduction Train of thought analysis First of all, we need to understand how the Yang Hui triangle was formed. As shown in the figure, the beginning and end numbers of each layer are 1, and the number of each remaining position is equal to the sum of the number of the corresponding position of its upper laye ...

Posted by abgoosht on Tue, 11 Jan 2022 14:37:51 +0100

LeetCode sort linked list

Give you the head node of the linked list. Please arrange it in ascending order and return the sorted linked list. Example 1: Β  Input: head = [4,2,1,3] output: [1,2,3,4] Example 2: Β  Input: head = [-1,5,3,4,0] output: [- 1,0,3,4,5] Example 3: Input: head = [] output: [] Idea: At first glance, this problem is to sort the linked ...

Posted by cowboysdude on Tue, 11 Jan 2022 13:06:18 +0100

The second day of algorithm practice in 2022 winter vacation (1.11)

** Preface: prepared by Golang leetcode Title: 162 Find peak Binary decomposition method: time complexity: O(log n), space complexity: O(1) Logic Description: When looking for the peak, because the title says that just look for one. And nums[-1] and nums[len (nums)] are expressed as negative infinity, so the following situations can be cons ...

Posted by MsAngel on Tue, 11 Jan 2022 12:47:41 +0100

Brush questions every day Day02

Question 1: Roman numerals to integers Roman numerals contain the following seven characters: I, V, X, L, C, D and M. Character value I  1 V  5 X  10 L   50 C 100 D 500 M 1000 For example, the Roman numeral 2 is written as II, which is two parallel ones. 12 is written as XII, which is X + II. 27 is written as XXVII, which is XX + V + II. Usual ...

Posted by macpaul on Tue, 11 Jan 2022 12:07:42 +0100

LeetCode 707 design linked list -- realize the basic operation of linked list

Source: LeetCode Link: https://leetcode-cn.com/problems/design-linked-list Design the implementation of linked list. You can choose to use single linked list or double linked list. A node in a single linked list should have two attributes: val , and val , next. Val , is the value of the current node, and next , is the pointer / referenc ...

Posted by apaxson on Mon, 10 Jan 2022 16:05:46 +0100