Tag:Positive number

  • [activities that babies can understand] [30 day leetcoding challenge] day 3


    Hi, everyone, I’m Zhang Xiaozhu. Welcome to the 30 day leetcoding challenge, a special article in the “baby can understand” series. This is an official little activity of leetcode. It can be seen on the official website that from April 1, the official will choose a question every day, and you can get a little […]

  • Hey! Don’t forget this C language knowledge~ 0 = = – 1 (problem)


    Today, I’ll take you to review a forgotten C language knowledge point, the storage of negative numbers and a typical investigation form. Let’s look at a topic first #include  int main()  {  int   a,b,c,d;    // perhaps     int   a,b,c,d;  a=0x8;   b=a>>1;   c=~(~0<<1);   d=b&c;   printf(“c is %d\n”,c);   printf(“d is %d\n”,d);  }    Resolution: Suppose the computer is storing eight […]

  • Talk about my understanding of rwmutex of go


    Rwmutex core is based on mutex. If you want to know about mutex, you can take a look at my last mutex article Rwmutex supports concurrent reading. It is suitable for the scene of more reading and less writing. Definition of rwmutex type RWMutex struct { W mutex // mutex Writersem uint32 // semaphore for […]

  • O. Θ, Ω, O, ω, don’t be confused!


    preface This article is included in the album:http://dwz.win/HjK, click to unlock more knowledge of data structure and algorithm. Hello, I’m brother Tong, a hard core man who climbs 26 floors every day and doesn’t forget to read the source code. In the previous sections, we learned how to analyze the complexity of the algorithm, and […]

  • Front end bug record – what is scientific counting?


    Scientific counting is a method of counting.Features: precision loss, space saving What is scientific counting Express a number as a and aThe form of multiplication of n-th power of 10(1 ≤| a | < 10, a is not a fraction, n is an integer).19971400000000 == 1.99714×10^13 == 1.99714e13 When we want toTo mark or calculate […]

  • The use of Yii redis set


      The set of redis is unordered, and its members are unique and cannot be repeated. Users can quickly add elements, remove elements and check whether an element exists in the collection. Here are some common set processing commands and their use in Yii. SADD SADD:SADD key-name item [item …]Add one or more elements to […]

  • Leetcode 41. Missing first positive number | Python


    41. Missing first positive number Title Source: leetcode https://leetcode-cn.com/problems/first-missing-positive subject To give you an unsorted integer array, please find the smallest positive integer that does not appear in it. Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3,4, – 1,1] Output: 2 Example 3: Input: [7,8,9,11,12] Output: 1 Tips: The time complexity of your […]

  • Shaggot event book – regular expressions


    //Nonzero positive integers var num1 = /^+?[1-9][0-9]*$/; //Positive integer + 0 var num2 = /^d+$/; //Positive number var num3 = /^d+(?=.{0,1}d+$|$)/; //Amount format var moneyReg = /(^[1-9]([0-9]+)?(.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9].[0-9]([0-9])?$)/; Keep updating

  • Stack sequential storage


    Array implementation stack Create three files: stackearray. H, stackearray. C, stackearraytest. C stackArray.h #ifndef STACK_ARRAY_H_ #define STACK_ARRAY_H_ #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT StackArray //Function: the process of comparison between a and B //Parameters: A, B //Return: a > B returns a […]

  • Circular queue – sequential storage


    Array to achieve circular queue Create three files: queuearray. H, queuearray. C, and queuearraytest. C queueArray.h #ifndef QUEUE_ARRAY_H_ #define QUEUE_ARRAY_H_ #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT QueueArray //Function: the process of comparison between a and B //Parameters: A, B //Return: a > […]

  • Circular double ended queue sequential storage


    Array implementation of circular double ended queue Create 3 files: doubleendedqueuearray. H, doubleendedqueuearray. C, doubleendedqueuearraytest. C doubleEndedQueueArray.h #ifndef DOUBLE_ENDED_QUEUE_ARRAY_H_ #define DOUBLE_ENDED_QUEUE_ARRAY_H_ #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif #define ADT DequeArray //Function: the process of comparison between a and B //Parameters: A, B //Return: a […]

  • Binary heap sequential storage


    Implementation of binary heap by array Create three files: heaprarray. H, heaprarray. C, heapararraytest. C heapArray.h #ifndef HEAP_ARRAY_H_ #define HEAP_ARRAY_H_ #ifdef __GNUC__ #define DEPRECATED __attribute__( (deprecated) ) #elif defined(_MSC_VER) #define DEPRECATED __declspec( deprecated ) #else #define DEPRECATED #endif #ifndef PTOI #define PTOI( p ) ((int32_t)(int64_t)(p)) #endif #ifndef ITOP #define ITOP( i ) ((void *)(int64_t)(i)) #endif […]