This article focuses on the simplest dichotomy, focusing on those issues that we have not paid attention to, and unravels the non-simple side of dichotomy. In this article, the author will take you to recognize dichotomy again.
There are a number of n coins, and a scale. It is known that there is a counterfei ...
Posted on Wed, 22 Sep 2021 14:28:02 -0400 by sqishy
155. Minimum stack force buckle (LeetCode)
Released: 17:29:18, September 22, 2021
Problem description and examples
Design a stack that supports push, pop and top operations and can retrieve the smallest element in a constant time. push(x) -- pushes element x onto the stack. pop() -- delete the element at the top of the stack. top() -- get ...
1. Title Description
please use only two queues to implement a last in first out (LIFO) stack, and support all four operations of ordinary stack (push, top, pop and empty). Implement MyStack class: void push(int x): push element x into the top of the stack. int pop(): removes and retur ...
Posted on Wed, 22 Sep 2021 09:29:37 -0400 by jariizumi
Code 1 : Power of Two
Given an integer n, return true if it is a power of two. Otherwise, return false.
An integer n is a power of two, if there exists an integer x such that n == 2x.
Input: n = 1
Explanation: 2^0 = 1
Input: n = 16
Explanation: 2^4 = 16
Input: n = 3
Output: false ...
Posted on Tue, 21 Sep 2021 04:06:05 -0400 by Stingus
Roman numerals contain the following seven characters: I, V, X, L, C, D and M.
For example, the Roman numeral 2 is written as II, which is two parallel ones. 12 is written as XI ...
Posted on Tue, 21 Sep 2021 03:28:07 -0400 by leap500
I came to work in the company. I had a week's competition in my spare time. I asked three questions. I'm very satisfied. Ha ha ha.
2011. Variable value after operation
Posted on Mon, 20 Sep 2021 15:46:55 -0400 by devang23
Algorithmic thinking - greed
The biggest difficulty in solving problems with greed is to prove that the choice of greed is the best. Commonly used proof methods: counter evidence method and mathematical induction method
Number of non overlapping intervals 435. Non-overlapping Intervals(Medium) Throw darts to pierce the balloon 452. Minimum N ...
Posted on Mon, 20 Sep 2021 12:56:26 -0400 by djremiasz
Punch in day9
Question 1: Sword finger Offer 21. Adjust the array order so that odd numbers precede even numbers
Enter an integer array and implement a function to adjust the order of numbers in the array so that all odd numbers are in the first half of the array and all even numbers are in the second half of the array.
Example: Input ...
Posted on Mon, 20 Sep 2021 05:46:23 -0400 by venradio
Given an integer array A, you can jump A certain number of times from A starting index. In the process of your jump, the 1st, 3rd, 5th... Jumps are called odd jumps, while the 2nd, 4th, 6th... Jumps are called even jumps.
You can jump back from index i to index j (where i < j) as follows:
When performing odd jumps (e.g., 1st, ...
Backtracking algorithm -- N queen problem
Backtracking algorithm has been bothering me for a long time. After watching the video of backtracking algorithm, I specially wrote this algorithm to deepen my impression.
General formula of backtracking algorithm
The backtracking algorithm has a general formula.
if(Judge whe ...