编写函数反转字符串
Example:
Given s = “hello”, return “olleh”.
编写函数反转字符串
Example:
Given s = “hello”, return “olleh”.
Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.
A string is actually an array of unicode characters
. You can perform almost all the operations we used in an array.
However, there are some differences. In this article, we will go through some of them which you should be aware of when dealing with a string. These features might vary a lot from one language to another.
Similar to a one-dimensional array, a two-dimensional array also consists of a sequence of elements. But the elements can be laid out in a rectangular grid rather than a line.
An array is a basic data structure to store a collection of elements sequentially. But elements can be accessed randomly since each element in the array can be identified by an array index.
An array can have one or more dimensions. Here we start with the one-dimensional array, which is also called the linear array