20210805 summary of force deduction string questions

Daily question 611: judge whether it is a triangle My inherent impression is to use violence to solve, then timeout, and then sort the array and recalculate. It is passed, but it takes too long. class Solution { public int triangleNumber(int[] nums) { int n = nums.length; if(n<3) return 0; int count = 0; ...

Posted by glence on Tue, 04 Jan 2022 13:15:57 +0100

The combination of java foundation and source code is an important knowledge point for understanding string classes

String class String classes mainly refer to string, StringBuffer and StringBuilder. As can be seen from the source code comments, both string and StringBuffer are jdk1 0, and StringBuilder is jdk1 5. Generally speaking, the most commonly used is String, which is immutable, followed by variable StringBuilder and StringBuffer. StringBuffer is th ...

Posted by JamesThePanda on Tue, 04 Jan 2022 09:37:04 +0100

[daily force deduction 15] effective letter words

1, Title [LeetCode-242] Given two strings s and t, write a function to determine whether t is an alphabetic ectopic word of s. Note: if each character in , s and t , occurs the same number of times, then , s and t , are called alphabetic words. Example 1: Input: s = "anagram", t = "nagaram" Output: true Exa ...

Posted by sebjlan on Tue, 04 Jan 2022 02:50:46 +0100

[Java] String is immutable, is that true? Deep Analysis from Principle

People who learn Java get more or less the message that String is immutable. So is that true? Pre-knowledge of this article: Reflection, jmm. 1. How to change a String Open the source of the String and you can see that the data of the String object is stored in its value array. In the early version of Java, this is an array of type char[], r ...

Posted by calevans on Mon, 03 Jan 2022 08:12:23 +0100

Codeforces Round #735 (Div. 2)

This div2 mainly focuses on the derivation of the formula and the optimization of time complexity. This requires us to be sensitive to some digital patterns in life. The topic gives us a lot of hints, such as the amount of data in 1e5. If we adopt the method of pairing one by one, the time complexity will timeout. Considering the nesting of va ...

Posted by telsiin on Mon, 03 Jan 2022 03:37:24 +0100

Dictionary tree (prefix tree)

Dictionary tree (prefix tree) summary: The dictionary tree (Trie) is used to determine whether a string exists or has a string prefix. Why do we need a dictionary tree to solve this kind of problem? If we have a dictionary that stores nearly 10000 words, even if we use hash, the actual cost of searching for a word in it is very lar ...

Posted by raker7 on Sun, 02 Jan 2022 23:51:42 +0100

[real time update] learning of String and stringbuild methods (the method is simple and suitable for novices)

The object of String is immutable, StringBuffer and The object of StringBuilder is variable, and StringBuilder is an improved class of StringBuilder. The methods of the two are similar. Therefore, we mainly record the methods in learning String and stringbuild classes.     Methods in String 1.intern() translation address There are no ...

Posted by libertyct on Sun, 02 Jan 2022 21:34:13 +0100

Embedded foundation -- parsing string

Hello, everyone. I'm surprised. Let's talk about string today. There are many scenarios for using strings, which are used in human-computer interaction and dual computer communication. For example: Send instructions to MCU through serial port to perform operation or configure parameters.MCU reads sensor data, and the data format is string. Gen ...

Posted by Nommy on Sat, 01 Jan 2022 20:28:01 +0100

CCF CSP command line options

subject Problem description Please write a command line analyzer to analyze which options are included in a given command line. Each command line consists of several strings separated by exactly one space. The first of these strings is the name of the command-line tool, which is composed of lowercase letters. Your program does not need ...

Posted by merylvingien on Fri, 31 Dec 2021 23:02:42 +0100

7-46 hot topics on Sina Weibo (30 points) (ideas + detailed explanation + set + map)pta click one by one, brothers

1: Title Sina Weibo can embed "topic" in the speech, that is, the topic text in the speech can be written between a pair of "#" to generate a topic link. Click the link to see how many people are discussing the same or similar topics with themselves. Sina Weibo will also update the list of hot topics at any time, and put t ...

Posted by Oaquasis on Mon, 27 Dec 2021 12:47:30 +0100