Tag:Shift left

  • 16. The closest is leetcode — C language and JS

    Time:2022-5-6

    1、 Double finger needling — C language implementation /** *The nearest sum of three numbers *Leetcode question 16 * author: aliao language: C */ #include <stdio.h> #include <stdlib.h> int compare (const void *a, const void *b) { return (*(int *)a) – (*(int *)b); } int threeSumClosest(int *nums, int numsSize, int target) { //Sort the array […]

  • Tetris Tetris game

    Time:2022-4-9

    Document establishment date: March 21, 2020Last revision date: NoneRelevant software information: win10 Python 3.7.6 Numpy 1.18.1 PySimpleGUI 4.16.0 Note: please quote or change this article at will. Just indicate the source and author. The author does not guarantee that the content is absolutely correct. Please be responsible for any consequences Title: Tetris Tetris game Write […]

  • PHP implements snowflake to generate distributed unique ID

    Time:2022-2-22

    Twitter’s snowflake is widely used in distributed generation of unique UUIDs, and there are many algorithms based on some variants of snowflake on the Internet. Many of the UUIDs generated by using snowflake are used in distributed scenarios. I read several articles on the Internet that are implemented in PHP without considering thread safety. Now […]

  • Algorithm | Chapter 5: Golden code for programmer interview related to bit operation

    Time:2022-1-22

    catalogue preface 0. * Experience Summary 0.1 programmer interview Jindian p94 0.2 bit operation related code in Java 1. Arithmetic shift 2. Logical shift 3. Get digits 4. Set digit 5. Reset digit 6. Update digit 0.3 Java method to judge whether double is an integer 0.4 Java binary conversion API 0.5 common API of […]

  • How to deal with the new development model?

    Time:2022-1-12

    Why do you need to test shift left and shift right? Testing can ensure product quality, and its importance is self-evident. However, it is also difficult to do well in testing, and many challenges need to be overcome. In particular, continuous delivery, agile development and other development modes have brought greater time pressure to the […]

  • Golang constant

    Time:2021-11-17

    Constants are constant values relative to variables and are often used to define those values that will not change during program operation Definition and use of constants The declaration of constants is very similar to that of variables, except thatvarInsteadconst, constants are definedMust be assigned. In program development, we use constants to store data that […]

  • How to use the displacement operator in Java?

    Time:2021-11-17

    Learning Java is a matter of accumulation. Maybe you can master some superficial technologies through self-study and learn some basic aspects of Java through systematic learning, but you still need the accumulation of your own technology and work experience to be proficient. 1) The “signed” left shift operator (< <) can move the operand on […]

  • Understanding bit operation

    Time:2021-11-7

    Original code, inverse code, complement code In terms of integers, integer data in PHP occupies 8 bytes of memory, that is, 64 bit bits, and each bit is either 0 or 1;We use the first bit on the left as the sign bit, 0 is positive and 1 is negative; Original code: binary converted from […]

  • Design and implement an LRU cache class

    Time:2021-10-25

    Title: Implement lrucache class: Lrucache (int capacity) initializes the LRU cache with a positive integer as capacity Int get (int key) if the keyword key exists in the cache, the value of the keyword is returned; otherwise, – 1 is returned. Void put (int key, int value) if the keyword already exists, change its data […]

  • Bitwise operators of basic operators in C language (6)

    Time:2021-8-5

    For more compact data, C programs can store information with independent bits or multiple bits combined together. File access permission is a common application case. The bit operator allows processing of independent bits in a byte or larger data unit: any bit or multiple bits can be cleared, set, or inverted. You can also move […]

  • Realization of distributed generation of unique PHP flake ID

    Time:2020-12-4

    Twitter’s snowflake is widely used in distributed generation of unique UUID, and there are also many variants of the algorithm based on snowflake on the Internet. Many of the UUIDs generated by using snowflake are used in distributed scenarios. I have seen several articles on the Internet that are implemented in PHP without considering thread […]

  • Division without division

    Time:2020-11-27

    preface At the beginning of July, we challenged leetcode‘s question 29 (medium difficulty, which seems nothing to boast about). The problem requires that the function of integer division be realized without division, multiplication and modular operation. Since the divisor and divisor are integers, subtraction can be used to achieve division (what a naive idea). A […]