[leetcode question brushing day 34] 540 Unique element in array, 384 Disrupt array, 202 Happy number, 149 Maximum number of points on a line
Day 34
540 a single element in an ordered array
Give you an ordered array of integers, where each element will appear twice and only one number will appear once.
Please find and return the number that appears only once.
The solution you design must meet O(log n) time complexity and O(1) space complexity.
method
Since all elements in the a ...
Posted by atyndall on Mon, 14 Feb 2022 14:33:23 +0100
Leetcode3-4 (longest substring without repeated characters, finding the median of two positive arrays)
1. Longest substring without repeated characters
① Violent solution
According to the topic, convert the string to char type, cycle once, and then use a temp variable of temporary StringBuffer type for judgment. If the current byte does not exist in the temp string, it will be traced. Otherwise, it will be intercepted, and then continue to run ...
Posted by TCovert on Mon, 14 Feb 2022 06:51:08 +0100
[Template Summary] - Binary Search Tree BST - Basic
Template Title Link
BST Lookup- Leetcode 270. Closest BST ValueBST Insert- Leetcode 701. Insert Node in BSTBST Delete- Leetcode 450. Delete Node in BST
Binary Search Tree-BST Overview
BST is a kind of binary tree, which has the structural properties of binary tree: there is only one Root node, each node can have at most two left and right sub ...
Posted by Quadodo on Sun, 13 Feb 2022 18:42:38 +0100
[daily problem] Li Kou - game 280 (I really didn't know how to solve other people's problems so succinctly)
⭐ New pit in winter vacation -- daily question notes of code Fox 😢 The winter vacation is about to expire 😢
6007. Maximum sum of array - Hard - game 280 weekly question 4
Give you an integer array nums with length N and an integer numSlots, satisfying 2 * numSlots > = n. There are a total of numSlots baskets numbered 1 to numSlots.
Y ...
Posted by andrewgauger on Sun, 13 Feb 2022 15:18:17 +0100
861. Score after flipping the matrix
Address:
Force bucklehttps://leetcode-cn.com/problems/score-after-flipping-matrix/
Title:
There is A two-dimensional matrix , A, where the value of each element is , 0 , or , 1.
Move refers to selecting any row or column and converting each value in the row or column: change all 0 to 1 and all 1 to 0.
After making any number of moves, ...
Posted by Vivid Lust on Sun, 13 Feb 2022 10:16:31 +0100
[daily practice of Android spring moves] LeetCode Hot 5 questions + Android framework
overview
LeetCode Hot: middle order traversal of binary tree, different binary search trees, verification binary search tree, symmetric binary tree, sequence traversal of binary tree Android framework: establish connection and connection pool
LeetCode Hot
2.36 middle order traversal of binary tree
Given the root node of a binary tree, r ...
Posted by chrys on Sat, 12 Feb 2022 16:24:39 +0100
JAVA exercise 114 - cat and mouse
The two players play the role of cat and mouse respectively, and play the game on an undirected graph. They take turns.
The form of graph is: graph[a] is a list, which is composed of all nodes b satisfying that ab is an edge in the graph.
The mouse starts from node 1 and starts first; The cat starts from node 2 and starts the second. There is ...
Posted by drunknbass on Sat, 12 Feb 2022 13:22:55 +0100
[sword finger offer] 10- I. Fibonacci sequence (it takes three hours to study something more essential)
Say something before brushing
If you want to cut the length of the article, you will say it in addition to the length of the code,
Because too much time is wasted in writing articles!
In fact, it's not difficult to brush the questions. What's difficult is to insist!
This column is the classic title of sword finger offer,
And record you ...
Posted by The_Stranger on Sat, 12 Feb 2022 06:00:21 +0100
Summary of dynamic programming of leetcode 3
Summary of dynamic programming of leetcode 3
1 - house raiding Title Link: Title Link stamp here!!!
Idea: the idea of this question is not difficult, but we need to pay attention to the details. Recurrence formula: DP [i] = max (DP [I-1], DP [I-2] + num [i])
class Solution {
public int rob(int[] nums) {
if(nums.length==1){
...
Posted by dwnz on Sat, 12 Feb 2022 03:49:12 +0100
[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "maximum Rectangle"
1, Title Requirements
Given a two-dimensional binary matrix containing only 0 and 1 and the size of rows x cols, find the largest rectangle containing only 1 and return its area.Example 1:
Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]
Output: 6
Example 2:
Input: matrix = []
Outp ...
Posted by solarisuser on Fri, 11 Feb 2022 15:49:53 +0100