Solution to problem 18 of leetcode (python analysis)

leetcode brush inscription -- > 18 problem solving method (python analysis) Definition of title Solving problems 1. Use dichotomy 2. Optimization by dichotomy 3. Use recursive thinking 4. Continue to optimize the dichotomy Realization Definition of title Given a n array of N integers nums a ...

Posted by freephoneid on Sat, 18 Jan 2020 18:46:15 +0100

Distributed ID - snowflake algorithm

background With the increasing business volume, the division of database is becoming more and more detailed, and the concept of sub database and sub table is also gradually implemented. The generation of primary key ID such as auto increase primary key or sequence no longer meets the demand, so the ...

Posted by rallokkcaz on Sat, 18 Jan 2020 10:12:11 +0100

Panoramic mosaic of Opencv

Requirement Combine the following two pictures to produce panoramic mosaic effect. Code implementation process 1. Import required libraries import numpy as np import cv2 2. Create a class Stitcher The Stitcher class contains five methods, which are stitch(self, images, ratio=0.75, reprojThresh ...

Posted by Nirvana on Sat, 18 Jan 2020 07:46:50 +0100

C Language Review In-depth Study: Arrays and Pointers

C Array Arrays are sequential collections that store a series of variables of the same type.All arrays consist of contiguous memory locations. Declare Array You need to specify the type and number of elements type arrayName [ arraySize ]; Initialize Array //The number of values between braces { ...

Posted by axiom82 on Sat, 18 Jan 2020 02:40:05 +0100

raft theory and practice [3]-lab2a explanation

Explanation of lab2a experiment 1. raft structure complementary field of raft.go.Fields should be as close as possible to Figure2 from raft's paper. type Raft struct {     mu        sync.Mutex          // Lock to protect shared access to this peer's state     peers     []*labrpc.ClientEnd // RPC end points of all peers     persister *Persister ...

Posted by DesertFox07 on Fri, 17 Jan 2020 17:47:33 +0100

High level language programming -- Chapter 6: pointers

Chapter VI indicators 1. Count the number of integers [problem description] input a string, including numeric and non numeric characters, such as: a123x456 17935? 098tab, take the consecutive numbers as an integer, store them in array a in turn, count the total number of integers, and output these n ...

Posted by Mackey18 on Fri, 17 Jan 2020 11:32:02 +0100

python implements tail-f function

This article was originally written because there was an interview in the reboot group, and the written examination question had this question. I don't know how to do it, what kind of thinking, so I sent it to everyone in the group for discussion I've thought about it for a moment. Let's briefly talk about my idea. Of course, there is also a ve ...

Posted by markstrange on Thu, 16 Jan 2020 19:30:52 +0100

Seven sorting algorithms

Seven sorting algorithms Direct insert sort Selection sort Selection sort Bubble sort Quick sort Merge sort Heap sort Direct insert sort When the I (I > = 1) element is inserted, the preceding array[0],array[1] , array[i-1] has been ordered. At this time, use the sorting code of array[i] and ...

Posted by poe on Thu, 16 Jan 2020 16:02:38 +0100

Learn more about oom (low memory crash) in iOS

In the iOS development process or user feedback, you may often see this situation. When you use it, you will crash. When you check the crash stack in the background, you cannot find the crash log. In fact, most of this may be due to the system's low memory crash, that is, oom (another possibility is tha ...

Posted by drums on Thu, 16 Jan 2020 10:18:18 +0100

Queue + matrix + linked list problem

Queue + matrix + linked list problem Cat dog queue Rotation print matrix (rotation matrix) . zigzag printing matrix Finding numbers in a matrix with ordered rows and columns Print a common part with two ordered linked lists Determine whether a linked list is a palindrome mechanism Divide the unidirec ...

Posted by donkeychoker on Thu, 16 Jan 2020 05:13:38 +0100