Data structure and program design of leetcode in the direction of postgraduate entrance examination (miscellaneous articles such as number and stack, including train of thought solutions)

Digital problem 9. Number of palindromes Algorithm idea: 1. First, judge whether x is a negative number. If it is a negative number, it directly returns false without conversion 2. Assign the palindrome number y according to the flashback until Y > = X. at this time, if x = = y | x = = Y / 10, it is the palindrome number, otherwise it ...

Posted by elwadhos on Tue, 17 May 2022 18:01:13 +0300

leetcode | stack and queue

232. Implement queue with stack (simple) Use the stack to implement the following operations of the queue: push(x) -- put an element at the end of the queue. pop() -- removes the element from the queue header. peek() -- returns the element at the head of the queue. empty() -- returns whether the queue is empty. Example: MyQueue queue = new MyQ ...

Posted by marian on Tue, 17 May 2022 14:29:27 +0300

Blue Bridge Cup 09th 2018 Provincial Competition C/C++ College Students Group B - Question 2 Clear Code

Test question 2 clear code The glyphs of Chinese characters exist in the font library, and even today, the 16-dot font library is still widely used. The 16-dot font library regards each Chinese character as 16x16 pixel information. And record this information in bytes. One byte can store 8 bits of information, and 32 bytes can store the glyph ...

Posted by misterph on Sun, 15 May 2022 06:56:43 +0300

Stack (array simulation stack, implement simple calculator)

An overview of the stack 1.1 What is a stack A stack is a collection type based on a first-in-last-out (FILO-First In Last Out) strategy. A stack is a special linear list that restricts the insertion and removal of elements to the same end. One end that allows insertion and deletion of elements is the changing end, called the top of th ...

Posted by ts2000abc on Thu, 28 Apr 2022 16:54:25 +0300

Leetcode question brushing diary 2021.2.6 (supplementary)

Leetcode writing diary 2021.2.6 (supplementary) Title Link: https://leetcode-cn.com/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof/solution/mian-shi-ti-09-yong-liang-ge-zhan-shi-xian-dui-l-3/ Problem Description: Queue with two stacks Answer 1: Using Stack code: import java.util.Stack; class CQueue { Stack<Integer> appendSt ...

Posted by DaveMate on Thu, 21 Apr 2022 04:07:23 +0300

Deep understanding of the memory allocation and execution process of defer

defer performance The release of the official version of go 1.13 has improved the performance of defer, claiming to improve the performance by 30% for defer scenarios. This release improves performance of most uses of defer by 30%. Before go 1.13, only the defer statement will be translated into two procedures by the compiler: 1. Callback ...

Posted by suspect on Mon, 18 Apr 2022 00:29:42 +0300

leetcode -- evaluation of inverse Polish expression

1, Problem description Find the value of the expression according to the inverse Polish representation. Valid operators include +, -, *, /. Each operand can be an integer or another inverse Polish expression. Note: integer division only retains the integer part; The given inverse Polish expression is always valid. In other words, an expressio ...

Posted by gatoruss on Sun, 17 Apr 2022 17:47:56 +0300

Understand ArrayDeque

1. Preface We often use two data structures in actual software development: Stack and Queue. The Java language has a class that implements a Stack, but Stack is an ancient class with poor performance. Java provides the Queue interface, but does not provide the Queue implementation class. When we need to use Stack or Queue, ArrayDeque is re ...

Posted by Koobazaur on Mon, 11 Apr 2022 00:22:10 +0300

cortex-m3/m4 stack backtracking

objective In order to better analyze the hardfault problem and the code card in a certain place, but it is not convenient for simulation, it is necessary to understand what the stack of m3 and m4 is and locate the problem faster. Preparatory knowledge The kernel has the following registers: R0~R12, SP (R13), LR (R14), PC (R15), xPSR. When en ...

Posted by crazycaddy on Sat, 09 Apr 2022 11:45:29 +0300

Implementation of < data structure > stack

catalogue preface        Concept of stack        Stack structure Implementation of stack        Create stack structure        Initialization stack        Destroy stack        Push        Out of stack        Get stack top element        Get the number of valid elements in the stack        Check whether the stack is empty Total code ...

Posted by Repgahroll on Sun, 03 Apr 2022 11:21:08 +0300