LeetCode 005 string series

String (3) Hello, everyone! I'm Xiao Sheng! I was busy learning java back-end technology, delayed the update of algorithm topics, and was ashamed to set up a weekly brushing plan to break through. Now I'm on the road of brushing again, keep it up! Go on! String (3) Series of questions as follows Subsequence (392) 392. Judgment Subseq ...

Posted by brainstorm on Sat, 18 Sep 2021 11:41:23 -0700

[out of order version ● sword finger offer] daily algorithm problem punch in problem solution - dynamic programming (topic No. 42,46,47,48)

Punch in day7 Question 1: Sword finger Offer 42. Maximum sum of continuous subarrays Enter an integer array. One or more consecutive integers in the array form a sub array. Find the maximum value of the sum of all subarrays. The required time complexity is O(n). Example 1: Input: num = [- 2,1, - 3,4, - 1,2,1, - 5,4] Output: 6 Explana ...

Posted by GravityFX on Fri, 17 Sep 2021 09:19:17 -0700

[Swordfinger Offer] Search and Backtrace Algorithms

Today is still the application of search algorithm, but today there are more depth-first search algorithms, the data structure is still a tree, involves more knowledge of recursion, so the code volume is less. Swordfinger Offer 26.Substructure of Trees Enter two binary trees A and B to determine if B is a substructure of A. (A convention empt ...

Posted by hws on Wed, 15 Sep 2021 17:29:17 -0700

LeetCode 138 copies linked lists with random pointers

Title Description: Give you a linked list with a length of n. each node contains an additional random pointer random, which can point to any node or empty node in the linked list. To construct this linked list   Deep copy.   The deep copy should consist of exactly n new nodes, in which the value of each new node is set to the value ...

Posted by Zaid on Mon, 13 Sep 2021 21:05:07 -0700

[Java] summary of basic interview questions!

1. Why do you have to override the hashcode method when you override the equals method? equals() and hashCode() are both built-in methods in the Object class. The native equals() uses = = to compare the memory addresses of the two objects. hashCode is a native method. Different objects get different hashcodes. A subclass of Object, such as St ...

Posted by wisewood on Mon, 13 Sep 2021 14:20:26 -0700

Array topic two-part search

array Binary search 704. Two point search - LeetCode (LeetCode CN. Com) Solution: class Solution { public int search(int[] nums, int target) { int mid; int left = 0, right = nums.length-1; while (left <= right){ // mid = (left + right) / 2; mid = left + ((right-left) / 2);//Overflow can ...

Posted by djjamiegee on Sun, 12 Sep 2021 14:38:24 -0700

Force buckle leetcode top100 1. Sum of two numbers

Title: given an integer array nums   And an integer target value, please find and as the target value target in the array    That   Two   Integers and return their array subscripts. You can assume that each input will correspond to only one answer. However, the same element in the array cannot be repeated in the answer. ...

Posted by bdichiara on Fri, 10 Sep 2021 12:47:31 -0700

Leetcode: 68. Align text left and right

subject Source: LeetCode Link: https://leetcode-cn.com/problems/text-justification Given an array of words and a length maxWidth, rearrange the words into text with exactly maxWidth characters per line and aligned left and right ends. You should use "greedy algorithm" to place a given word; That is, put as many words in each line as ...

Posted by ozzythaman on Fri, 10 Sep 2021 01:02:00 -0700

The number i/ii/iii that appears only once in LeetCode

The number i that appears only once Title Description Topic analysis When I first looked at the question of xxxx, I had no idea at all. The method is too inefficient. Later, I saw on the Internet that the solution uses XOR, but I haven't understood what the principle is. Recently, the school is learning "the principle of computer ...

Posted by taiger on Sun, 05 Sep 2021 11:16:27 -0700

Summary of Array and Chain List Properties

1. Storage of data structures There are only two ways to store data structures: array (sequential storage) and chain table (chain storage). What do you mean by this sentence? Aren't there any data structures like hashes, stacks, queues, heaps, trees, graphs, etc? When we analyze problems, we must have recursive thinking, from top to bottom, ...

Posted by jonex on Thu, 02 Sep 2021 01:02:15 -0700