DSA Lesson 4 of 33

Strings

Learn how strings are stored and processed as sequences of characters.

Course Progress12%

Theory

A string is a sequence of characters. Strings are commonly used to represent names, messages, sentences and other textual information. String problems are very common in DSA and often involve searching, reversing, comparing or modifying characters.

Example

const text = "CodingWithMee"; console.log(text.length); console.log(text[0]); console.log(text.toUpperCase());

Expected Output

The length, first character and uppercase version of the string are displayed.

Practice

Write a program that reverses a string.

Interview Questions

  1. What is a string?
  2. How do you find the length of a string?
  3. How can a string be reversed?
  4. Why are strings important in DSA?