0% found this document useful (0 votes)
14 views

String Deails Notes Done

The document defines what a string is in computer programming. It explains that a string is a sequence of characters, typically used to represent text, and is considered a data type used to store and manipulate textual data. It notes that a character can be any symbol and strings are usually enclosed in quotation marks, with programming languages using either single or double quotes consistently. The document then provides examples of string practice problems.

Uploaded by

wahexi4619
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

String Deails Notes Done

The document defines what a string is in computer programming. It explains that a string is a sequence of characters, typically used to represent text, and is considered a data type used to store and manipulate textual data. It notes that a character can be any symbol and strings are usually enclosed in quotation marks, with programming languages using either single or double quotes consistently. The document then provides examples of string practice problems.

Uploaded by

wahexi4619
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Let’s UnderStand What is String?

In computer programming, a string is a sequence of


characters, typically used to represent text. In most
programming languages, a string is considered a data
type, and it is often used to store and manipulate
textual data.

A character in a string can be any symbol, including


letters, numbers, punctuation, and whitespace.

Strings are usually enclosed in quotation marks. The


type of quotation marks (single or double) depends on
the programming language, but the common practice
is to use either single or double quotes consistently
throughout your code.

01
Now, It’s Time For Practice :)
01. Reverse Words in a String
Given an input string s, reverse the order of the words.
A word is defined as a sequence of non-space characters.

The words in s will be separated by at least one space.

Return a string of the words in reverse order


concatenated by a single space.

Practice

02. Longest Palindromic Substring


Given a string s, return the longest palindromic substring
in s.

Practice

02
03. Longest Common Prefix
Write a function to find the longest common prefix string
amongst an array of strings.

If there is no common prefix, return an empty string "".

Practice

04. Repeated String Match


Given two strings a and b, return the minimum number of
times you should repeat string a so that string b is a
substring of it. If it is impossible for b​​to be a substring of
a after repeating it, return -1.

Notice: string "abc" repeated 0 times is "", repeated 1


time is "abc" and repeated 2 times is "abcabc".

Practice

03
05. Valid Anagram
Given two strings s and t, return true if t is an anagram of
s, and false otherwise.

An Anagram is a word or phrase formed by rearranging


the letters of a different word or phrase, typically using
all the original letters exactly once.

Practice

06. Valid Palindrome II


Given a string s, return true if the s can be palindrome
after deleting at most one character from it.

Practice

07. Integer to English Words


Convert a non-negative integer num to its English words
representation.

Practice
04
08. Group Anagrams
Given an array of strings strs, group the anagrams
together. You can return the answer in any order.

An Anagram is a word or phrase formed by rearranging


the letters of a different word or phrase, typically using
all the original letters exactly once.

Practice

09. Basic Calculator II


Given a string s which represents an expression, evaluate
this expression and return its value.

The integer division should truncate toward zero.

You may assume that the given expression is always valid.


All intermediate results will be in the range of [-231, 231 - 1].

Practice

05
10. Text Justification
Given an array of strings words and a width maxWidth,
format the text such that each line has exactly maxWidth
characters and is fully (left and right) justified.

You should pack your words in a greedy approach; that is,


pack as many words as you can in each line. Pad extra
spaces ' ' when necessary so that each line has exactly
maxWidth characters.

Extra spaces between words should be distributed as


evenly as possible. If the number of spaces on a line does
not divide evenly between words, the empty slots on the
left will be assigned more spaces than the slots on the
right.

For the last line of text, it should be left-justified, and no


extra space is inserted between words.

Practice

06

You might also like