My roommate learned to balance the binary tree after riding a small sheep

⭐ ♪ previous words ⭐ ️ hello everyone! This article will introduce the sword finger offerOJ question, which comes from Li Kou[ Sword finger Offer 55 - II balanced binary tree ]This paper will introduce the balanced binary tree based on the concept of binary tree and the depth of binary tree, and show that the code language is Java and C/C + ...

Posted by Ifa on Thu, 23 Dec 2021 18:20:24 +0100

LeetCode_ Array_ Medium_ 59. Spiral matrix II

1. Title Give you a positive integer n to generate an n x n square matrix containing all elements from 1 to n2 and the elements are spirally arranged in clockwise order. Example 1: Input: n = 3 Output: [[1,2,3], [8,9,4], [7,6,5]] Example 2: Input: n = 1 Output: [[1]] Tips: 1 <= n <= 20 Source: LeetCode Link: https://leetcode-cn.c ...

Posted by kapishi on Wed, 22 Dec 2021 06:40:25 +0100

Puge algorithm dichotomy

Dichotomy? Let's look at a very interesting passage first One day Xiao Ming went to the library to borrow N books. When he got out of the library, the alarm sounded, so the security guard stopped Xiao Ming to check which book was not registered for lending. Xiao Ming is going to pass each book under the alarm to find out the book tha ...

Posted by kindoman on Wed, 22 Dec 2021 06:25:42 +0100

Daily exercise - "calculating the value of Boolean expression" LeetCode Plus member exclusive question [detailed analysis] Hive / MySQL

Hello, I'm Lao Wu. You can also call me classmate Wu. Younger friends can also call me senior brother Wu. Welcome to the world of data analysis with me and learn together! Interested friends can pay attention to me Data analysis column , there are many high-quality articles to share with you. In addition, you are also welcome to pay attention ...

Posted by iimrii on Tue, 21 Dec 2021 23:18:07 +0100

Sword finger offer_008 and the shortest subarray greater than target

Title: Given an array containing n , positive integers and a positive integer target. Find out the continuous sub array [numsl, numsl + 1,..., numsr-1, numsr] with the smallest length satisfying its sum ≥ target in the array, and return its length. If there is no eligible subarray, 0 is returned. Example 1: Input: target = 7, N ...

Posted by ashben on Tue, 21 Dec 2021 22:55:41 +0100

Two single linked lists generate an additive linked list

[title] assuming that the value of each node is between 0 and 9, the whole linked list can represent an integer. For example, 9 - > 3 - > 7 can represent an integer 937. Given the header nodes head1 and head2 of the two linked lists, please generate a result representing the added value of the two integers [example] [note] first find th ...

Posted by vishal99 on Tue, 21 Dec 2021 00:55:38 +0100

LeetCode elementary and intermediate algorithm solution - binary tree

introduction:   the difficulty of collecting questions is at the simple level and intermediate level. It is also a common topic in interviews. The development language used for the solution of the problem is Swift.   because the description of the topic is very long and there are various case tips, it is not displayed in order to no ...

Posted by gijs25 on Tue, 21 Dec 2021 00:46:10 +0100

iOS LeetCode ☞ maximum number of splices

Given two arrays of length m and N, their elements are composed of 0 - 9, representing the numbers on each bit of two natural numbers. Now select k (k < = m + n) numbers from the two arrays and splice them into a new number. The numbers taken from the same array are required to maintain their relative order in the original array. Find the m ...

Posted by immanuelx2 on Mon, 20 Dec 2021 17:33:42 +0100

Array and string 10 - implement strStr()

Using KMP algorithm to implement str () One topic From leetcode official website Here are two strings, haystack and need. Please find the first position where the need string appears in the haystack string (the subscript starts from 0). If it does not exist, it returns - 1. Note: when the need is an empty string, we should return 0. This is c ...

Posted by angelac on Mon, 20 Dec 2021 12:08:54 +0100

Learning to find two points in three problems -- solving problems in java, python and c ( ̄▽  ̄)~*

Binary search Binary search is usually applied to an ordered array. It is an algorithm that divides the search space into two after each comparison. Terms used in binary search: Target: target. The value you want to find Index: index. The current location you want to find Left, Right: left and Right indicators (which can be understood as ...

Posted by kelvin on Mon, 20 Dec 2021 11:18:43 +0100