Tag:Reciprocal

  • Query all data of the penultimate date in the table

    Time:2021-11-7

    To query all employees on the penultimate entry date in the employee table, employees on the same day should be considered, so useFind out the penultimate date first, and then use this date to query all equal employee information SELECT * FROM `employees` WHERE `hire_date` = ( SELECT DISTINCT `hire_date` FROM `employees` ORDER BY `hire_date` […]

  • 34. Bubble sort

    Time:2021-3-11

    Reference website https://visualgo.net/ Bubble sort: Compare the two numbers in pairs Before < after, the latter one continues to compare with the next one Before > after, switch positions, and then compare with the next one After the first round of comparison, the position of the last number can be determined The second round is […]

  • Implementation of reduce method

    Time:2021-2-6

    Implementation of reduce method Array.prototype._reduce = function (fn, initial) { //If there is an initial value, note that the initial value is passed to undefined or null, and there is no initial value, but null means there is a value let hasInitial = initial != undefined //If there is an initial value, the loop starts […]

  • Java: put odd numbers on the left and even numbers on the right in one-dimensional array

    Time:2020-7-9

    Algorithm idea Compare the first number, if it is odd, judge the second number; if the second number is even, judge the penultimate number is even, then judge the penultimate number is odd, then complete the exchange, and reduce the value judged next time. The efficiency of the algorithm is n package com.itheima.kuihuabaodian; import java.util.Scanner; […]

  • [Leetcode-09] 9. Palindrome Number

    Time:2020-2-28

    Subject requirements Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Determines whether an integer is a palindrome. Palindromes are integers that are read in the same positive (left to right) and reverse (right to left) order.Link: https://leetcode-cn.com/probl Example Input: 121 Output: true Input: […]