[a daily question with a little insight] simulation question - three in one (number of matches, diagonal experience, life game)

⭐ New pit in winter vacation -- daily question notes of code Fox 1688. Number of matches in the competition Give you an integer n to represent the number of teams in the game. The competition follows a unique competition system: If the current number of teams is even, each team will be paired with another team. A total of n / 2 games were ...

Posted by mindspin311 on Tue, 25 Jan 2022 13:42:41 +0100

[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "deleting duplicates in ordered arrays"

1, Title Requirements Give you an ordered array nums, please delete the repeated elements in place, make each element appear only once, and return the new length of the deleted array.Do not use additional array space. You must modify the input array in place and complete it with O(1) additional space.explain: Why is the returned value an in ...

Posted by priya_amb on Tue, 25 Jan 2022 05:27:06 +0100

Yiwen church 01 Backpack

01 Backpack 01 backpack refers to a topic template If there are many things, each thing can only be loaded into a backpack once, and the backpack has an upper volume limit This is the classic 01 knapsack problem When we subconsciously recite the template Let's first think about the violent solution to the 01 knapsack problem In the 01 bac ...

Posted by kate_rose on Mon, 24 Jan 2022 21:49:08 +0100

Algorithm -- LeetCode 468 Verify IP address

1. Title Original question link Write a function to verify whether the input string is a valid IPv4 or IPv6 address. If it is a valid IPv4 address, return "IPv4"; If it is a valid IPv6 address, return "IPv6"; "Neither" is returned if the IP address is not of the above type. IPv4 addresses are represented by dec ...

Posted by Shuriken1 on Mon, 24 Jan 2022 20:10:41 +0100

[daily force deduction 29] symmetric binary tree

1, Title [LeetCode-101] Give you the root node of a binary tree, root, and check whether it is axisymmetric. Example 1: Input: root = [1,2,2,3,4,4,3] Output: true Example 2:   Input: root = [1,2,2,null,3,null,3] Output: false Tips: The number of nodes in the tree is in the range [1, 1000]-100 <= Node.val <= 100 A ...

Posted by K3nnnn on Mon, 24 Jan 2022 17:38:31 +0100

Some problem solving ideas and templates of binary tree

Complete binary tree concept A complete binary tree can have no right subtree and no left subtree. Problem solving ideas Judge whether it is a complete binary tree: using the sequence traversal method, if it is found that there is right or left, or the first left and right nodes are not complete, the subsequent nodes must be leaf nodes, oth ...

Posted by drakkon on Mon, 24 Jan 2022 14:06:49 +0100

Leetcode 2034. Stock price fluctuation__ Dual set storage

2034. Stock price fluctuation Give you a data stream of stock prices. Each record in the data stream contains a time stamp and the price corresponding to the stock at that time point. Unfortunately, due to the inherent volatility of the stock market, stock price records may not come in chronological order. In some cases, some records may be w ...

Posted by T_Hayden on Mon, 24 Jan 2022 08:23:46 +0100

Prepare for the second test, three questions a day, Day17

Prepare for the second test, three questions a day Topic 1: minimum insertion times of balanced bracket string Give you a parenthesized string s, which contains only the characters' ('and'). A parenthesized string is called balanced when it satisfies: Any left parenthesis' ('must correspond to two consecutive right parentheses'). The left pa ...

Posted by Victorm on Mon, 24 Jan 2022 07:14:16 +0100

Leetcode 2140. Solving intellectual problems

Title Link Game 276 week 3 https://leetcode-cn.com/problems/solving-questions-with-brainpower/ Topic content Give you a two-dimensional integer array questions with subscript starting from 0, where questions[i] = [pointsi, brainpoweri]. This array represents a series of questions in an exam. You need to solve them in order (that is, startin ...

Posted by joozt on Mon, 24 Jan 2022 06:52:06 +0100

leetcode force buckle - Sword finger offer brush question - day3-004 A number that appears only once

Sword finger Offer II 004 Number that appears only once - LeetCode (LeetCode CN. Com)https://leetcode-cn.com/problems/WGki4K/ You want to use brute force cracking through array traversal directly, but in the use case [43,16,45,89,45, - 2147483648,452147483646, - 2147483647, - 2147483648,432147483647, - 2147483646, - 2147483648,89, - 2147483 ...

Posted by BryonS on Mon, 24 Jan 2022 03:44:53 +0100