LeetCode_ Interview question 01.05 Primary edit [medium]
There are three editing operations for Strings: insert a character, delete a character, or replace a character. Given two strings, write a function to determine whether they require only one (or zero) edit.
first = "pale"
second = "ple"
output: Tru ...
Posted by Tyrant on Fri, 13 May 2022 23:56:30 +0300
D124 1175. Prime Arrangements
1175. Prime Arrangements
This question, give a number n to generate an array from 1 to N. how many permutations make the number of prime digits prime? Where 1 < = n < = 100
Since the final return value may be large, please return the result after mod (10 * * 9 + 7).
In other ...
Posted by raquelzinha on Fri, 13 May 2022 17:15:13 +0300
In ACM algorithm competition / LeetCode using C + + to brush questions and other scenarios, usually:
A lot of C + + source code needs to be maintained
Multiple main function entries are required to facilitate test execution
Some self written public function class libraries (such as debug output vector, etc.) are referenced in multiple files
Posted by DarkendSoul on Thu, 12 May 2022 18:47:09 +0300
Design your loop queue implementation. Circular queue is a linear data structure whose operation performance is based on FIFO (first in first out) principle, and the tail of the queue is connected after the head of the queue to form a loop. It is also called "ring buffer".
One of the benefits of circular queues is that we can use the ...
Posted by dan231 on Thu, 12 May 2022 00:02:06 +0300
Questions that need to open vip will be skipped temporarily
Click the link to jump to the navigation link of all brush notes
401. Binary Watch
The top of the binary watch has 4 LEDs representing hours (0-11) and the bottom 6 LEDs representing minutes (0-59).
Each LED represents a 0 or 1, with the lowest bit on ...
Posted by CodeMama on Tue, 10 May 2022 15:53:22 +0300
Write in front: this blog is only for my summary and notes, not for any commercial purpose. If there is any infringement, please contact me to delete it. Thank you. (see the end for reprint link)
Method 1: violent solution (understand, friends who are not interested can skip directly)
Enumerate all subintervals:
Use double-layer loop to enum ...
Posted by anna_cm on Mon, 09 May 2022 20:47:58 +0300
Title address: https://leetcode-cn.com/problems/generate-parentheses/
Given that n represents the logarithm of the generated parentheses, please write a function so that it can generate all possible and effective parenthesis combinations. For example, given n = 3, the gen ...
Posted by sundawg on Sat, 07 May 2022 22:48:58 +0300
Solve using queues
Title address: https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/
Given a string containing only the numbers 2-9, return all letter combinations it can represent. The mapping of numbers to letters is given as follows (same as phone k ...
Posted by johnpaine on Sat, 07 May 2022 10:12:49 +0300
Oj599: sum of two numbers 1
Given an array from small to large and a target number t, find two numbers in it, make the sum of the two numbers equal to the target number, and output the position of the two numbers in the array.
The first line contains two integers n,t. (1≤n≤1000000,1≤t≤20000000)
The num ...
Posted by dearmoawiz on Wed, 04 May 2022 17:56:02 +0300
Solution I Python implementation
Solution 2: Python code
81. Search in Rotated Sorted Array II
Search for a target in a rotated ordered array that may contain duplicate elements. If the target is found in the array, ...
Posted by AceOfJames on Tue, 03 May 2022 18:47:44 +0300