Standard template library skillfully solves algorithm problem hash table

Introduction to hash table Hash table, also known as hash table, uses O(n) spatial complexity to store data, and maps the location through hash function, so as to realize the insertion, search, deletion and other operations with approximate O(1) time complexity. The hash set in C + + is unordered_set to find out whether the element is in the ...

Added by programguru on Sun, 24 Oct 2021 04:44:33 +0300

[sword finger Offer] sort

Self-Improvement Money is not life's report card. Money cannot be used to measure whether life is wonderful or not. Common algorithms The following figure shows the sorting process of common sorting algorithms under the four types of input data of "random disorder", "near order", "complete reverse order&quot ...

Added by Aikon on Mon, 18 Oct 2021 06:02:24 +0300

Adding two numbers -- hash table algorithm

1, Foreword Please take care of me for the first time. Hello, everyone. I'm Sanshui, a junior reading algorithm Xiaobai. Today is the fourth day I brush leetcode algorithm! This is the first time I have published my article on the platform. In the future, I will continue to share some humble opinions and knowledge in the process of learnin ...

Added by DavidP123 on Sat, 16 Oct 2021 22:17:46 +0300

leetcode [array medium] 209. Subarray with the smallest length

preface Hello, I'm long Lu. I'm just a junior now. I'm working on the back end and occasionally on the front end. Now the main language is Java. For a long time before, I was learning some technologies of web development. I haven't studied and brushed questions like data structures and algorithms for a long time. I plan to pick them up and ...

Added by bugsuperstar37 on Fri, 15 Oct 2021 20:53:30 +0300

Leetcode DFS + backtracking topic (under update)

[product understanding foundation DFS] 695. Maximum area of the island This problem is equivalent to finding the largest sub block size in the connected sub blockYou need to mark whether the grid has been accessedThe essence of using the direction array to cycle four times is the same as directly writing the following code. It depends on ...

Added by DoD on Fri, 15 Oct 2021 02:06:22 +0300

[leetcode] hash table - Roman numeral to integer

Title: Roman numerals contain the following seven characters: I, V, X, L, C, D and M. characternumerical valueI1V5X10L50C100D500M1000 For example, the Roman numeral 2 is written as II, which is two parallel ones. 12 is written as XII, which is X + II. 27 is written as XXVII, which is XX + V + II. Usually, the small Roman numerals are to the r ...

Added by sprint10s on Wed, 13 Oct 2021 05:38:31 +0300

[Leetcode monotone stack] 84. The largest rectangle in the histogram (dp optimized double pointer calculation with jump saving calculation!! how to think about the problem solution!!)

Leetcode84 1. Problem description 2. Solutions Solution 1: double pointer (O(n^2) timeout) (thinking about a solution to the problem 1. I can understand it by looking at the figure. For each column, the largest rectangle containing this column is the area between the first smaller column on the left and right, and then find the ma ...

Added by Buddha443556 on Wed, 13 Oct 2021 03:28:03 +0300

Algorithm problem solving (Leetcode 48, 49, 53, 55, 56)

48. Rotating image - medium - 9 / 26 48. Rotating image - medium - 9 / 26 Given an n × The two-dimensional matrix of N represents an image. Please rotate the image 90 degrees clockwise. You have to rotate the image in place, which means you need to modify the input two-dimensional matrix directly. Do not use another matrix to rota ...

Added by Revan on Fri, 08 Oct 2021 04:35:08 +0300

LeetCode question 98 -- verifying binary search tree

This article will share the solution ideas and steps of LeetCode question 98 in detail, hoping to bring help to you. preface Binary tree is a very important data structure. It involves a wide range of algorithms. Whether it is an amazing backtracking algorithm or an amazing dynamic programming, it is closely related to binary tree, whic ...

Added by geaser_geek on Thu, 07 Oct 2021 03:38:15 +0300

Leetcode 166, fraction to decimal

Problem Source : https://leetcode-cn.com/problems/fraction-to-recurring-decimal/ Solution Source : https://github.com/hujingbo98/algorithm/blob/master/source/leetcode/0166_FractionToRecurringDecimal.cpp 166. Fraction to decimal Given two integers representing the numerator and denominator of the fraction, return the decimal in the form of st ...

Added by timski72 on Sun, 03 Oct 2021 22:59:40 +0300