Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Judge whether the string is valid in java

Shulou Source: shulou.com Published: 2022-06-01 01:01:03 10月06日 Update

This article "determine whether the string is valid in java" is not quite understood by most people except programmers. Today, in order to make you understand "judging whether the string is valid in java", Xiaobian summed up the following content, which has a certain reference value. The detailed steps are clear and the details are handled properly. I hope you can get something through this article. Next let's take a look at the specific content.

Given a string that includes only'(',')','{','}','[',']', determine whether the string is valid.

A valid string must satisfy:

The left parenthesis must be closed with the same type of closing parenthesis.

The left parenthesis must be closed in the correct order.

Note that an empty string can be considered a valid string.

Example 1:

Enter: "()"

Output: true

Example 2:

Enter: "() [] {}"

Output: true

Example 3:

Enter: "(]"

Output: false

Example 4:

Enter: "([)]"

Output: false

Example 5:

Enter: "{[]}"

Output: true

Parsing:

Here, let front take n steps, then front and back go at the same time until front.next is empty, find the last but one node, and then delete it.

What are the basic data types of java? the basic data types of Java can be divided into: 1. Integer types, which are used to represent the data types of integers. 2. Floating point type, which is used to represent the data type of decimals. 3. Character type. The keyword of character type is "char". 4. Boolean type, which is the basic data type that represents logical values.

Thank you for your reading. I hope you have a certain understanding of the key issue of "judging whether the string is valid in java". The specific usage still needs to be understood by yourself. Try it quickly. If you want to read more articles about relevant knowledge points, welcome to follow the industry information channel!

Tags: Type character string valid data example input output content parentheses integers closure proper same value key keyword and at the same time most decimal Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Information Docker MariaDB Shulou Tech Info